Featured on Awesome-algorithms & Ruby-bookmarks
This repository contains Ruby implementation of various Algorithms and Data structures and solution of many challenges of Leetcode, Exercism, HackerRank and Codility
- Searching
- Heuristic
- Sorting
- Arrays
- Strings
- Hashing
- Stacks
- Linked List
- Bit Algorithms
- Mathematics
- Trees
- Dynamic Programming
- Exercism Ruby Track
- LeetCode
- HackerRank
- Codility
- Binary Search
- Ubiquitous Binary Search (Binary search implementation with various applications)
- Problems based on Binary Search
- Find fixed point in sorted array
- Find smallest missing number in sorted array
- Find majority element in sorted array
- Find minimum element in sorted rotated array
- Search element in sorted rotated array
- Find maximum element in a Bitonic Array
- Find no. of occurences of an element in a sorted Array
- Find floor and ceil of given element in a sorted Array
- Find the element with odd occurences if all other elements have even occurences
- Find the median of two sorted array of equal size
- First Bad Version
- Bubble Sort
- Optimized Bubble Sort
- Selection Sort
- Insertion Sort
- Shell Sort
- Merge Sort
- Quick Sort
- 3 way Quick Sort
- Counting Sort
- Pancake Sort
- Sort array in wave form
- Sort a given array by frequency of elements
- Radix Sort
- Heap Sort
- Swapping two numbers
- Algorithm for reversing an array
- Algorithms for array rotation
- Juggling Algorithm for array rotation
- Reversal Algorithm for array rotation
- Block Swap Algorithm for array rotation
- Subarray Problems(Kadane's Algorithm)
- Find missing number in array
- Shuffling an Array
- Find pair in array with sum equal to given value
- Find pair in array with difference equal to given value
- Find pair in array with sum closest to given value
- Find triplet in array with sum equal to given value
- Find Pythagorean triplet in given array
- Find equilibrium index in an array
- Find fixed point in an array
- Dutch National Flag Problem
- Move all zeros to the end of array
- Find all Leaders in an array
- Find smallest missing number in sorted array
- Majority Element in an array
- Find minimum element in sorted rotated array
- Search element in sorted rotated array
- Find maximum element in a Bitonic Array
- Find no. of occurences of an element in a sorted Array
- Find floor and ceil of given element in a sorted Array
- Replace every element by product of previous and next
- Find the element with odd occurences if all other elements have even occurences
- Print the maximum element in each k-sized subarray
- Print Next Greatest Element for each element of array
- Replace every element by maximum element on the right side(Next Greatest Element)
- Find the smallest and second smallest in a given array
- Find the maximum sum with no adjacent elements
- Given two sorted arrays find the union and intersection of arrays
- Given unsorted array of numbers check if numbers are consecutive
- Sort a given array by frequency of elements
- Create a product array from given array
- Find the median of two sorted array of equal size
- Given a 2D array,print its all elements in spiral order
- Find two repeating elements in given array
- Minimum length unsorted subarray,sorting which makes the array sorted
- Find max diff between 2 elements such that larger appears after smaller
- Find duplicates in array in O(n) time and constant space
- Print all distinct elements of given array
- Given an array array, find the maximum j – i such that the element later is bigger
- Find pair in array with sum equal to given value(Approach 1)
- Find pair in array with difference equal to given value(Approach 2)
- Sort a given array by frequency of elements
- Print all distinct elements of given array(Approach 2)
- Longest Palindrome
- Print Next Greatest Element for each element of array
- Backspace String Compare
- Evaluate Reverse Polish Notation
- Implement Queue using Stacks
- Min Stack
- Reverse Linked List
- Middle of the Linked List
- Linked List Cycle
- Merge Two Sorted Lists
- Palindrome Linked List
- Remove nth node from end in list
- Check if a given number is power of 2 or not
- Check if a given number is even or odd
- Given a number return a number with last bit unset
- Count the number of set bits(Brian Kernighan's method)
- Find missing number in array(Approach 2)
- Find two repeating elements in given array(Approach 4)
- Add Binary
- Counting Bits
- Number of Set Bits
- Reverse Bits
- Fast multiplication of two numbers(Russian Peasant Multiplication)
- Babylonian Method to find Square root of a number
- Find missing number in array(Approach 1)
- Find two repeating elements in given array(Approach 1)
- Tree Node
- In-order Traversal
- Pre-order Traversal
- Post-order Traversal
- Invert Binary Tree
- Height of Binary Tree
- Same Tree
- Balanced Binary tree
- Symmetric Tree
- Subtree of Another Tree
- Binary Tree Level order Traversal
- Hello World
- Lasagna
- Amusement Park
- Amusement Parks Improvements
- Log Line Parser
- Assembly Line
- Savings Account
- Port Palermo
- Chess Game
- BlackJack
- Bird Count
- Boutique Inventory
- Boutique Inventory Improvements
- Locomotive Engineer
- Moviegoer
- Simple Calculator
- Two fer
- Resistor Color Duo
- Acronym
- High Scores
- Reverse String
- D&D Character
- Matrix
- Series
- Word Count
- Eliud's Eggs
- Hamming
- Raindrops
- Isogram
- Scrabble Score
- Luhn
- Clock
- Twelve Days
- Tournament
- Gigasecond
- Resistor Color
- Rna Transcription
- Leap
- Pangram
- Space Age
- Triangle
- DIfference of Squares
- Anagram
- Spiral Matrix
- Sum of Multiples
- Transpose
- Armstrong Numbers
- Flatten Array
- Phone Number
- Grains
- Resistor Color Trio
- Saddle Points
- ETL
- Nucleotide Count
- Pythogorean Triplet
- Collatz Conjecture
- Seive
- Proverb
- Palindrome Products
- Parallel Letter Frequency
- Bob
- Nth Prime
- Perfect Numbers
- Binary Search
- Matching Brackets
- All Your Base
- Allergies
- Run Length Encoding
- Robot Simulator
- Beer Song
- Protein Translation
- Wordy
- Secret Handshake
- Atbash Cipher
- Crypto Square
- List Ops
- Simple Linked List
- Binary Search Tree
- Rotational Cipher
- Largest Series Product
- Prime Factors
- Linked List
- ISBN Verifier
- Complex Number
- Microwave
- Darts
- Bank Account
- Gilded Rose
- Two Sum
- Valid Parentheses
- Merge Two Sorted Lists
- Best Time to Buy and Sell Stock
- Valid Palindrome
- Invert Binary Tree
- Valid Anagram
- Binary Search
- Linked List Cycle
- Reverse Linked List
- Middle of the Linked List
- Majority Element
- Contains Duplicates
- Squares of sorted array
- Move zeroes
- Longest Palindrome
- Palindrome Linked List
- First Bad Version
- Missing Number
- Single Number
- Palindrome Number
- Backspace String Compare
- Ransom Note
- Climbing Stairs
- Lowest Common Ancestor of BST
- Add Binary
- Max Depth of Binary Tree
- Sorted Array to BST
- Maximum Subarray Sum
- Same Tree
- Counting Bits
- Number of Set Bits
- Reverse Bits
- Meeting Rooms
- Roman to Integer
- Merge Intervals
- Insert Intervals
- Product of Array Except self
- Sort Colors
- Evaluate Reverse Polish Notation
- Remove nth node from end in list
- Implement Queue using Stacks
- Longest Common Prefix
- Three Sum/3sum
- 3sum Closest
- Min Stack
- Balanced Binary tree
- Symmetric Tree
- Subtree of Another Tree
- A Very Big Sum
- Diagnol Difference
- Plus Minus
- Simple Array Sum
- Solve Me First
- Staircase
- Time Conversion
- Angry Professor
- Chocolate Feast
- Cut The Sticks
- Find Digits
- Service Lane
- Sherlock And Squares
- Sherlock And The Beast
- Utopian Tree
1.Modified Kaprekar Number~New approach added by @madmantalking
- FrogRiverOne
- MaxCounters
- MissingInteger
- PermCheck
- CountDiv
- MinAvgTwoSlice
- Passing Cars