Skip to main content

All Questions

2 votes
2 answers
177 views

Finding minimum steps required to traverse from source to terminal

Hello everyone this is my first post here so please do critique my post if there's anything. I have made a program intended to pass a programming challenge on open.kattis.com, here. It should do as ...
ma22om's user avatar
  • 23
3 votes
0 answers
214 views

Codingame: Great Escape bot in Ruby - Follow-up

This is a follow-up to Codingame: Great Escape bot in Ruby. As mentioned there, my first reasonably sized Ruby project is a bot for CodinGame's Great Escape contest (here is a sample gameplay video). ...
Mangara's user avatar
  • 465
2 votes
3 answers
285 views

Project Euler - Smallest multiple (Ruby)

My code is very slow to run, and I am trying to find a way to make it more efficient. I know there must be a better way than to write each modulo operation. The goal of the script is to find the ...
tristan's user avatar
  • 21
6 votes
1 answer
165 views

Check sum of all primes under two million

I'm exploring ruby by writing a code that checks the sum of all prime numbers under two million. As I am still in the process of learning ruby, I'm unfamiliar with all the standards and best practices....
Ryan's user avatar
  • 163
3 votes
1 answer
1k views

Project Euler #10 in Ruby. Three ways to sum primes below 2 million

Question: Add all prime numbers smaller than 2,000,000. The first method is done by deriving own is_prime? method: ...
Chris Yeung's user avatar
3 votes
2 answers
76 views

Project Euler #1 in Ruby with duration

I have done #1 of Project Euler's in Ruby. Using two different approaches. One uses set, another uses reduce. ...
Chris Yeung's user avatar
0 votes
4 answers
218 views

Finding powers of multiple array pairs

I'm doing a challenge on TalentBuddy that requires you to find the powers of multiple array pairs. Since I got the solution right, but not fast enough, I decided I'd ask for help here. ...
Johnson's user avatar
  • 229
5 votes
2 answers
3k views

Reverse Game HackerRank Ruby Solution

Problem Statement Akash and Akhil are playing a game. They have N balls numbered from 0 to N−1. Akhil asks Akash to reverse the position of the balls, i.e., to change the order from ...
Gautam's user avatar
  • 153
3 votes
2 answers
182 views

Building a list - why is this code inefficient?

I'm attempting this code challenge. Here's my code modified to handle one simple example test case: ...
niftygrifty's user avatar
4 votes
2 answers
2k views

Performance of Codility MaxCounter challenge solution

I'm doing some of the Codility challenges using Ruby. The current challenge is "The MaxCounter," which is described as: Calculate the values of counters after applying all alternating operations: ...
Antarr Byrd's user avatar
3 votes
3 answers
418 views

Speed up counting sort algorithm in Ruby

I'm attempting this simple HackerRank counting sort problem but testcase #3, which has 100,000 test cases, is timing out. Is there something particularly inefficient about this code? ...
niftygrifty's user avatar