/HackerRank

HackerRank Solutions in PHP/C++/Python/Java, etc.

Primary LanguagePHP

Solutions to problems on HackerRank.

Algorithms AlgorithmsPoints

  • Warmup
  • Implementation
  • Strings
  • Sorting
  • Search
  • Graph Theory
  • Greedy
  • Dynamic Programming
  • Constructive Algorithms
  • Bit Manipulation
  • Recursion
  • Game Theory
  • NP Complete

DataStructures DataStructuresPoints

  • Arrays
  • Linked Lists
  • Trees
  • Balanced Trees
  • Stacks
  • Queues
  • Heap
  • Disjoint Set
  • Multiple Choice
  • Trie
  • Advanced

Mathematics MathematicsPoints

  • Fundamentals
  • Number Theory
  • Combinatorics
  • Algebra
  • Geometry
  • Probability
  • Linear Algebra Foundations

Java JavaPoints

  • Introduction
  • Strings
  • BigNumber
  • Data Structures
  • Object Oriented Programming]
  • Exception Handling
  • Advanced

Warmup

# Title Solution Time Space Difficulty Points Note
Solve Me First O(1) O(1) Easy 1
Simple Array Sum O(n) O(1) Easy 10
Compare the Triplets O(1) O(1) Easy 10
A Very Big Sum O(n) O(1) Easy 10
Diagonal Difference O(n) O(1) Easy 10
Plus Minus O(n) O(1) Easy 10
Staircase O(n) O(n) Easy 10
Mini-Max Sum O(1) O(1) Easy 10
Time Conversion O(1) O(1) Easy 15
Birthday Cake Candles O(n) O(1) Easy 10

Implementation

# Title Solution Time Space Difficulty Points Note
Grading Students O(n) O(1) Easy 10
Apple and Orange O(n+m) O(1) Easy 10
Kangaroo O(1) O(1) Easy 10
Between Two Sets O(x(n+m)) O(1) Easy 10 x=(max(m) - min(n))/min(n)
Divisible Sum Pairs O(n^2) O(1) Easy 10
Birthday Chocolate O(n) O(1) Easy 10
Breaking the Records O(n) O(1) Easy 10
Migratory Birds O(n) O(1) Easy 10
Day of the Programmer O(1) O(1) Easy 15
Bon Appetit O(n) O(1) Easy 10
Sock Merchant O(n) O(n) Easy 10
Drawing Book O(1) O(1) Easy 10
Counting Valleys O(n) O(1) Easy 15
Cats and a Mouse O(1) O(1) Easy 15
Electronics Shop O(n log (n)) O(1) Easy 15 n = m+n
Picking Numbers O(n) O(n) Easy 20
Climbing the Leaderboard O(n+m) (n) Easy 20
The Hurdle Race O(n) O(1) Easy 15
Designer PDF Viewer O(n) O(n) Easy 20
Forming a Magic Square O(1) O(1) Easy 20
Utopian Tree O(n) O(1) Easy 20
Angry Professor O(n) O(1) Easy 20
Beautiful Days at the Movies O(n) O(1) Easy 15
Viral Advertising O(n) O(1) Easy 15
Save the Prisoner! O(1) O(1) Easy 15
Circular Array Rotation O(n) O(1) Easy 20
Sequence Equation O(n) O(n) Easy 20
Jumping on the Clouds: Revisited O(n) O(n) Easy 15
Find Digits O(n) O(1) Easy 25
Extra Long Factorials O(n) O(1) Medium 20
Append and Delete O(n) O(1) Easy 20
Sherlock and Squares O(n) O(1) Easy 20
Library Fine O(1) O(1) Easy 15
Cut the sticks O(n log(n)) O(n) Easy 25
Non-Divisible Subset O(n) O(n) Medium 20
Repeated String O(n) O(n) Easy 20
Jumping on the Clouds O(n) O(n) Easy 20
Equalize the Array O(n) O(n) Easy 20
Queen's Attack II O(k) O(1) Medium 30
ACM ICPC Team O(n^3) O(n) Easy 25
Taum and B'day O(1) O(1) Easy 25
Organizing Containers of Balls O(n^2) O(n^2) Medium 30
Encryption O(n) O(1) Medium 30
Bigger is Greater O(n) O(n) Medium 35
Modified Kaprekar Numbers O(n) O(1) Easy 30
Minimum Distances O(n) O(n) Easy 20
Beautiful Triplets O(n) O(n) Easy 20
Strings: Making Anagrams O(|a|+|b|) O(1) Easy 30
The Time in Words O(1) O(1) Medium 25
Chocolate Feast O(log(n)) O(1) Easy 25 Base of logarithmic time complexity is m
Service Lane O(n) O(n) Easy 20
Lisa's Workbook O(n) O(1) Easy 25
Flatland Space Stations O(n) O(n) Easy 25
Fair Rations O(n) O(1) Easy 25
Cavity Map O(n^2) O(n^2) Easy 30
Manasa and Stones O(n) O(1) Easy 30
The Grid Search O(n) O(n) Medium 30 n = len(word)
Happy Ladybugs O(n) O(n) Easy 30
Strange Counter O(n) O(1) Easy 30 n = t
Absolute Permuation O(n) O(n) Medium 40
The Bomberman Game O(n*m) O(n*m) Medium 40
Ema's Supercomputer Medium 40
Larry's Array Medium 40
Almost Sorted Medium 50
Matrix Layer Rotation O(n*m) O(n*m) Hard 80
Consecutive 1s in Binary Numbers O(n) O(1) Easy 30
Nested Logic O(1) O(1) Easy 40
Bitwise AND O(1) O(1) Easy 20