  Intermediate RubyIntermediate level challenges and solutions

Course Material

View all Ruby courses
Next Ruby course
• Challenges
• Prime Time

For this challenge you will be determining if an argument is a prime number. 17018 solutions

• Run Length

For this challenge you will determine the Run Length Encoding of a string. 13152 solutions

• Prime Mover

For this challenge you will be returning a certain prime number. 10078 solutions

• Palindrome Two

For this challenge you will be determining if a string is a palindrome. 11003 solutions

• Division

For this challenge you will determine the Greatest Common Factor between two numbers. 8867 solutions

• String Scramble

For this challenge you will determine if string 1 can be rearranged into string 2. 11249 solutions

• Arith Geo II

For this challenge you will determine if numbers within an array follow an arithmetic or geometric sequence. 6251 solutions

For this challenge you will determine if numbers in an array can add up to a certain number in the array. 8302 solutions

• Binary Converter

For this challenge you will be converting a number from binary to decimal. 6295 solutions

• Letter Count

For this challenge you will determine which word has the greatest number of repeated letters. 6860 solutions

• Caesar Cipher

For this challenge you will transform a string using the Caesar Cipher. 7559 solutions

• Simple Mode

For this challenge you will determine the mode, the number that appears most frequently, in an array. 6598 solutions

• Consecutive

For this challenge you will determine how to order an array of numbers consecutively. 5842 solutions

• Formatted Division

For this challenge you will divide two numbers and print them in a certain format. 4438 solutions

• Counting Minutes

For this challenge you will return the total number of minutes between two times. 4178 solutions

• Permutation Step

For this challenge you will determine the next greatest number using the same numbers of a given argument. 7662 solutions

• Prime Checker

For this challenge you will determine if you can arrange a number to be a prime number. 3977 solutions

• Dash Insert II

For this challenge you will be manipulating a string using dashes (-). 5856 solutions

• Swap II

For this challenge you will be manipulating numbers in a string based on the characters. 4013 solutions

• Number Search

For this challenge you will traverse a string searching for all the numbers and then you will add them up. 4518 solutions

• Triple Double

For this challenge you will determine if there is a number that appears consecutively in both arguments. 4174 solutions

• Bracket Matcher

For this challenge you will determine if the brackets in a string are correctly matched up. 8050 solutions

• String Reduction

For this challenge you will manipulate a string of characters using a simple reduction method. 6352 solutions

• ThreeFive Multiples

For this challenge you will be determining the multiples of a specific number. 3421 solutions

• Binary Search Tree LCA

For this challenge you will attempt to find the lowest common ancestor of a binary search tree. 901 solutions

• Coin Determiner

For this challenge you will be determining the smallest combination of coins for a given output 4840 solutions

• Fibonacci Checker

For this challenge you will be determining whether a number is part of the Fibonacci sequence. 4950 solutions

• Multiple Brackets

For this challenge you will determine if all the brackets in a string are correctly matched up. 3663 solutions

• Most Free Time

For this challenge you will determine what period of the day gives the most free time. 2913 solutions

• Overlapping Rectangles

For this challenge you will be determining the areas of rectangles. 2394 solutions

• Look Say Sequence

For this challenge you will determine the next number in a sequence. 1758 solutions

• Distinct List

For this challenge you will remove duplicate elements from an array. 4523 solutions

• Number Encoding

For this challenge you will encode a given string following a specific rule. 3133 solutions

• Stock Picker

For this challenge you will determine the maximum profit that can be made in a range of stock prices. 8035 solutions

• Max Subarray

For this challenge you will determine the largest sum subarray. 6651 solutions

• Missing Digit

For this challenge you will determine what the variable is in a mathematical equation. 4906 solutions

• K Unique Characters

For this challenge you will be searching a string for a particular substring. 3524 solutions

• Bitmap Holes

For this challenge you will be searching within a 2D matrix. 2315 solutions

• Symmetric Tree

For this challenge you will traverse a binary tree and determine if it is symmetric. 1283 solutions

• Binary Tree LCA

For this challenge you will attempt to find the lowest common ancestor of a binary tree. 681 solutions

• LRU Cache

For this challenge you will determine the order of elements within a simulated cache. 3770 solutions

• Tree Constructor

For this challenge you will determine if an array of integer pairs can form a binary tree properly. 5830 solutions

• Longest Increasing Sequence

For this challenge you will compute the length of the longest increasing subsequence. 6236 solutions

• Array Min Jumps

For this challenge you will determine how quickly you can reach the end of an array. 938 solutions

• Even Pairs

For this challenge you will determine if a pair of even numbers exists somewhere in a string. 1798 solutions

• Nearest Smaller Values

For this challenge you will determine the nearest smaller value for each number in an array. 1960 solutions

• Matrix Spiral

For this challenge you will print a 2D matrix in spiral order. 1211 solutions

• Word Split

For this challenge you will attempt to split a long string of characters into actual words. 5863 solutions

• Pair Searching

For this challenge you will determine how to multiply a number to find a duplicate pair. 390 solutions

• Boggle Solver

For this challenge you will attempt to find words in a matrix of letters. 919 solutions

• HTML Elements

For this challenge you will determine whether HTML elements are nested correctly. 2982 solutions

• Missing Digit II

For this challenge you will determine what the variables are in a mathematical equation. 402 solutions

• Palindromic Substring

For this challenge you will be finding the longest palindromic substring. 3410 solutions

• Trapping Water

For this challenge you will determine the largest amount of water you can trap within a boundary. 1609 solutions

• Matrix Path

For this challenge you will determine if a path exists in a boolean matrix. 613 solutions

• Seating Students

For this challenge you will determine how many different ways students can sit next to each other. 5362 solutions

• Longest Matrix Path

For this challenge you will be searching for the longest path in a 2D matrix. 606 solutions

• Min Window Substring

For this challenge you will be searching for the optimal substring of k characters. 6697 solutions

• Matrix Chains

For this challenge you will determine the best order to multiply matrices. 322 solutions

• Histogram Area

For this challenge you will determine the largest area under a histogram. 2109 solutions

• Matching Characters

For this challenge you will be determining the largest number of unique characters between two letters. 1394 solutions

• Ternary Converter

For this challenge you will be converting a decimal number into ternary. 428 solutions

• Linear Congruence

For this challenge you will be solving a linear congruence equation. 209 solutions

• Formatted Number

For this challenge you will be determining if a string is a valid number. 918 solutions

• Largest Row Column

For this challenge you will be finding the largest sum of three digits in a matrix. 235 solutions

• Eight Queens

This challenge will require knowledge of chess pieces and their movements. 5800 solutions

• Three Points

For this challenge you will be plotting a line on a Cartesian grid. 660 solutions

• Character Removal

For this challenge you will attempt to modify a word and then find it within a dictionary. 1035 solutions

For this challenge you will be determining if a string is a valid password. 5035 solutions

• Preorder Traversal

For this challenge you will be traversing a binary tree. 912 solutions

• String Zigzag

For this challenge you will be printing a string in a particular zig-zag format. 1352 solutions

• Off Binary

For this challenge you will be determining the correct binary number. 1187 solutions

• Longest Consecutive

For this challenge you will compute the length of the longest consecutive subsequence. 2046 solutions

• String Expression

For this challenge you will convert a string of written numbers to an actual number. 711 solutions

• Charlie the Dog

For this challenge you will be helping a dog collect all the food in a grid. 1125 solutions

• Plus Minus

For this challenge you will need to determine how to add or subtract numbers to end up with zero. 1575 solutions

• Primes

For this challenge you will be determining if an argument is a prime number. 619 solutions

• String Calculate

For this challenge you will be evaluating a mathematical expression within a string. 637 solutions

• Tree Constructor Two

For this challenge you will determine if an array of integer pairs can form a binary tree properly. 1898 solutions

• Logit Regression

For this challenge you will be performing a simple logistic regression. 373 solutions