Skip to content

Latest commit

 

History

History
676 lines (630 loc) · 91.8 KB

README.md

File metadata and controls

676 lines (630 loc) · 91.8 KB

Solutions to problems on HackerRank.

Check out HackerRank's new format here

If you are interested in helping or have a solution in a different language feel free to make a pull request.

Algorithms AlgorithmsPoints

DataStructures DataStructuresPoints

Mathematics MathematicsPoints

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

Java JavaPoints

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
  • Java
Medium 40
Larry's Array
  • Java
Medium 40
Almost Sorted
  • Java
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

Strings

# Title Solution Time Space Difficulty Points Note
Super Reduced String O(n) O(n) Easy 10
camelCase O(n) O(1) Easy 15
Strong Password O(n) O(1) Easy 15
Two Characters O(n) O(n) Easy 15
Caesar Cipher O(n) O(n) Easy 15
Caesar Cipher: Encryption O(n) O(n) Easy 40
Mars Exploration O(n) O(1) Easy 15
HackerRank in a String! O(n) O(1) Easy 20
Pangrams O(n) O(1) Easy 20
Weighted Uniform Strings O(n) O(n) Easy 20
Separate the Numbers O(n) O(n) Easy 20
Funny String O(n) O(n) Easy 25
Gemstones O(n) O(1) Easy 20
Alternating Characters O(n) O(1) Easy 20
Beautiful Binary String O(n) O(1) Easy 20
The Love-Letter Mystery O(n) O(1) Easy 20
Determining DNA Health
  • Java
Hard 50
Palindrome Index O(n) O(1) Easy 25
Anagram O(n) O(1) Easy 25
Making Anagrams O(n) O(n) Easy 30
Game of Thrones - I O(n) O(1) Easy 30
Two Strings O(|a| + |b|) O(1) Easy 25 a and b are lengths of the input strings
String Construction O(n) O(n) Easy 25
Sherlock and Valid String O(n) O(n) Hard 100
Richie Rich O(n) O(n) Medium 30
Sherlock and Anagrams
  • Java
Medium 50
Common Child
  • Java
Hard 60
Bear and Steady Gene
  • Java
Medium 50
Morgan and a String O((|a|+|b|)^2) O(|a| + |b|) Expert 100
Count Strings
  • Java
Hard 80
String Function Calculation
  • Java
Advanced 80
Build a Palindrome
  • Java
Advanced 80
Build a String
  • Java
Hard 80
Gridland Provinces
  • Java
Hard 80
Ashton and String
  • Java
Advanced 100
String Similarity
  • Java
Expert 100
Super Functional Strings
  • Java
Advanced 80
Circular Palindromes
  • Java
Advanced 120
Similar Strings
  • Java
Advanced 85
Save Humanity
  • Java
Expert 100
Find Strings
  • Java
Expert 100
Palindromic Border
  • Java
Expert 100
Two Two
  • Java
Advanced 150
Two Strings Game
  • Java
Expert 100
Letter Islands
  • Java
Expert 100
Pseudo-Isomorphic Substrings
  • Java
Expert 100
How Many Substrings?
  • Java
Expert 100

Sorting

# Title Solution Time Space Difficulty Points Note
Intro to Tutorial Challenges O(n) O(1) Easy 30
Insertion Sort - Part 1 O(n) O(1) Easy 30
Insertion Sort - Part 2 O(n^2) O(1) Easy 30
Correctness and the Loop Invariant O(n^2) O(1) Easy 30
Running Time of Algorithms O(n^2) O(1) Easy 30
Quicksort 1 - Partition O(n) O(n) Easy 10
Quicksort 2 - Sorting O(n^2) O(n) Easy 30
Quicksort In-Place O(n^2) O(log(n)) Medium 35
Running Time of Quicksort O(n log(n)) O(log(n)) Easy 35
Counting Sort 1 O(n+k) O(k) Easy 30 value of k in this problem is 100
Counting Sort 2 O(n+k) O(n+k) Easy 30 Value of k is 100 in this problem.
Counting Sort 3 O(n+k) O(k) Easy 30
The Full Counting Sort O(n+k) O(n+k) Medium 40
Closest Numbers O(n log(n)) O(n) Easy 35
Find the Median O(n log(n)) O(n) Easy 35
Insertion Sort Advanced Analysis
  • Java
Advanced 50
Fraudulent Activity Notifications O(n^2) O(n) Medium 40
Lily's Homework O(n log(n)) O(n) Medium 40
Big Sorting O(n log(n)) O(n) Easy 20

Search

# Title Solution Time Space Difficulty Points Note
Hackerland Radio Transmitters O(n log(n)) O(n) Medium 25
Ice Cream Parlor O(n) O(n) Easy 30
Binary Search: Ice Cream Parlor O(n) O(n) Easy 35
Gridland Metro O(k) O(k) Medium 25 k = number of tracks
Missing Numbers O(n) O(n) Easy 45
Minimum Loss O(n log(n)) O(n) Medium 35
KnightL on a Chessboard
  • Java
Medium 35
Pairs O(n log(n)) O(n) Medium 50
Sherlock and Array O(n) O(n) Easy 40
Maximum Subarray Sum
  • Java
Hard 65
Connected Cells in a grid
  • Java
Medium 50
Short Palindrome
  • Java
Medium 40
Maximizing Mission Points
  • Java
Hard 70
Count Luck
  • Java
Medium 50
Cut the Tree
  • Java
Medium 50
Making Candies
  • Java
Hard 45
Gena Playing Hanoi
  • Java
Medium 50
Beautiful Quadruples
  • Java
Medium 50
Bike Racers
  • Java
Hard 65
Task Scheduling
  • Java
Advanced 70
Similar Pair
  • Java
Advanced 70
Absolute Element Sums
  • Java
Hard 70
Sorted Subsegments
  • Java
Hard 80
Distant Pairs
  • Java
Expert 80
King Richard's Knights
  • Java
Hard 80

Graph Theory

# Title Solution Time Space Difficulty Points Note
Roads and Libraries
  • Java
Medium 30
Synchronous Shopping
  • Java
Medium 40
Crab Graphs
  • Java
Medium 50
Even Tree
  • Java
Medium 50
Snakes and Ladders: The Quickest Way Up
  • Java
Medium 50
Subset Component
  • Java
Hard 50
Journey to the Moon O(n + i) O(n) Medium 50
Kruskal (MST): Really Special Subtree
  • Java
Hard 50
Minimum Penalty Path
  • Java
Medium 50
Demanding Money
  • Java
Hard 50
The Story of a Tree
  • Java
Medium 50
Breadth First Search: Shortest Reach
  • Java
Medium 55
The Value of Friendship
  • Java
Hard 55
Clique
  • Java
Medium 60
Dijkstra: Shortest Reach 2
  • Java
Hard 60
Prim's (MST) : Special Subtree
  • Java
Medium 60
Roads in Hackerland
  • Java
Medium 60
Toll Cost Digits
  • Java
Hard 60
Real Estate Broker
  • Java
Hard 60
Matrix
  • Java
Hard 70
Bead Ornaments
  • Java
Advanced 70
Rust & Murderer O(n+m) O(n) Medium 70
Recording Episodes
  • Java
Hard 70
Kingdom Connectivity
  • Java
Hard 75
Journey Scheduling
  • Java
Hard 75
Floyd : City of Blinding Lights
  • Java
Hard 75
Find the Path
  • Java
Hard 75
Repair Roads
  • Java
Hard 80
Problem solving
  • Java
Hard 80
Computer Game
  • Java
Hard 80
Jack goes to Rapture
  • Java
Medium 80
Jim and his LAN Party
  • Java
Hard 80
Jeanie's Route
  • Java
Medium 80
Travel in HackerLand
  • Java
Hard 80
Jogging Cats
  • Java
Advanced 80
Tree Flow
  • Java
Hard 80
Tripartite Matching
  • Java
Hard 80
Jumping Rooks
  • Java
Advanced 80
Minimum MST Graph
  • Java
Expert 80
Coprime Paths
  • Java
Expert 80
DAG Queries
  • Java
Expert 80
Liars
  • Java
Advanced 85
ByteLandianTours
  • Java
Hard 90
Kth Ancestor
  • Java
Hard 90
Drive
  • Java
Expert 90
Road Network
  • Java
Expert 90
Savita And Friends
  • Java
Hard 90
Favorite sequence
  • Java
Advanced 95
Quadrant Queries
  • Java
Advanced 100
Going to the Office
  • Java
Expert 100
Ticket
  • Java
Expert 100
HackerX
  • Java
Hard 100
Hacker Country
  • Java
Hard 100
Travelling Salesman in a Grid
  • Java
Expert 100
Huarongdao
  • Java
Expert 100
Vertical Paths
  • Java
Expert 100
DFS Edges
  • Java
Expert 100
Tree Splitting
  • Java
Advanced 100
Definite Random Walks
  • Java
Expert 100
Diameter Minimization
  • Java
Expert 100
Training the army
  • Java
Hard 120
Alex vs Fedor
  • Java
Expert 150

Greedy

# Title Solution Time Space Difficulty Points Note
Minimum Absolute Difference in an Array O(n log(n)) O(n) Easy 15
Chief Hopper O(n) O(n) Hard 65
Mark and Toys O(n log(n)) O(n) Easy 35
Marc's Cakewalk O(n + k) O(k) Easy 15
Grid Challenge O(n*(n log (n))) O(n^2) Easy 20
Luck Balance O(n log(n)) O(1) Easy 20
Maximum Perimeter Triangle O(n log (n)) O(n) Easy 20
Permuting Two Arrays O(n log (n)) O(n) Easy 40
Jim and the Orders O(n log (n)) O(n) Easy 40
Equal Stacks O(n) O(n) Easy 25
Sherlock and The Beast O(n) O(n) Easy 30
Priyanka and Toys O(n log(n)) O(n) Easy 30
Largest Permutation O(n) O(n) Easy 30
Beautiful Pairs
  • Java
Easy 30
Yet Another Minimax Problem
  • Java
Medium 20
Flipping the Matrix O(n^2) O(n^2) Medium 30
Roads and Libraries
  • Java
Medium 30
Greedy Florist O(n log (n)) O(n) Medium 35
Mark and Toys O(n log(n)) O(n) Easy 35
Max Min O(n log(n)) O(1) Medium 35
Permuting Two Arrays
  • Java
Easy 40
Jim and the Orders
  • Java
Easy 40
Goodland Electricity
  • Java
Medium 40
Fun Game
  • Java
Medium 40
Reverse Shuffle Merge
  • Java
Advanced 50
Cutting Boards
  • Java
Hard 60
Algorithmic Crush
  • Java
Hard 60
Prim's (MST): Special Subtree
  • Java
Medium 60
Accessory Collection
  • Java
Hard 60
Chief Hopper O(n) O(n) Hard 65
Sherlock and MiniMax
  • Java
Hard 70
Team Formation
  • Java
Advanced 70

Dynamic Programming

# Title Solution Time Space Difficulty Points Note
Equal
  • Java
Medium 30
Cut Tree
  • Java
Medium 40
Mr K marsh
  • Java
Medium 40
Sam and sub-strings
  • Java
Medium 40
Summing Pieces
  • Java
Medium 40
Short Palindrome
  • Java
Medium 40
Abbreviation
  • Java
Medium 40
Fair Cut
  • Java
Medium 40
Fibonacci Modified Medium 45
Lego Blocks
  • Java
Medium 50
Candies
  • Java
Medium 50
Stock Maximize
  • Java
Medium 50
Angry Childtren 2
  • Java
Hard 50
The Maximum Subarray
  • Java
Medium 50
Sherlock and Cost
  • Java
Medium 50
Xor and Sum
  • Java
Medium 50
Counting Special Sub-Cubes
  • Java
Medium 50
Two Robots
  • Java
Medium 50
Kingdom Division
  • Java
Medium 50
Prime XOR
  • Java
Medium 50
HackerRank City
  • Java
Medium 50
Nikita and the Game
  • Java
Medium 50
Prime Digit Sums
  • Java
Medium 50
Mandragora Forest
  • Java
Medium 50
LCS Returns
  • Java
Medium 50
Grid Walking
  • Java
Medium 55
Bricks Game
  • Java
Medium 55
The Longest Common Subsequence
  • Java
Medium 55
Substring Diff
  • Java
Medium 60
Brick Tiling
  • Java
Hard 60
Alien Languages
  • Java
Hard 60
The Longest Increasing Subsequence
  • Java
Advanced 60
The Coin Change Problem O(N*M) O(N) Hard 60
Knapsack
  • Java
Medium 60
Sherlock's Array Merging Algorithm
  • Java
Hard 60
New Year Game
  • Java
Medium 60
Shashank and the Palindromic Strings
  • Java
Advanced 60
Decibinary Numbers
  • Java
Hard 60
Choosing White Balls
  • Java
Hard 60
DP: Coin Change
  • Java
Hard 60
Clues on a Binary Path
  • Java
Hard 60
GCD Matrix
  • Java
Hard 60
Coin on the Table
  • Java
Medium 65
Interval Selection
  • Java
Medium 65
Red John is Back
  • Java
Medium 65
Play with words
  • Java
Medium 65
Queens on Board
  • Java
Hard 70
String Reduction
  • Java
Hard 70
Far Vertices
  • Java
Hard 70
The Indian Job
  • Java
Medium 70
Hexagonal Grid
  • Java
Hard 70
Longest Palindromic Subsequence
  • Java
Hard 70
Turn Off the Lights
  • Java
Hard 70
Tara's Beautiful Permutations
  • Java
Hard 70
Two Subarrays
  • Java
Expert 70
Mining
  • Java
Advanced 75
The Longest Common Subsequence (LCS)
  • Java
Hard 75
Points in a Plane
  • Java
Advanced 80
Fairy Chess
  • Java
Advanced 80
Billboards
  • Java
Advanced 80
Requirement
  • Java
Advanced 80
A Super Hero
  • Java
Hard 80
Covering the stains
  • Java
Hard 80
Superman Celebrates Diwali
  • Java
Hard 80
Wet Shark and Two Subsequences
  • Java
Medium 80
Zurikela's Graph
  • Java
Hard 80
New Year Present
  • Java
Hard 80
Suffix Rotation
  • Java
Expert 80
Black and White Tree
  • Java
Hard 80
Beautiful Strings
  • Java
Hard 80
Longest Mod Path
  • Java
Hard 80
Super Functional Strings
  • Java
Advanced 80
Kitty's Calculations on a Tree
  • Java
Advanced 80
Liars
  • Java
Advanced 85
Dorsey Thief
  • Java
Advanced 85
Swap Permutation
  • Java
Medium 85
Candles Counting
  • Java
Medium 85
Square Subsequences
  • Java
Hard 90
Hyper Strings
  • Java
Advanced 90
Unique Divide And Conquer
  • Java
Advanced 90
Super Kth LIS
  • Java
Advanced 90
Counting Road Networks
  • Java
Expert 90
Lucky Numbers
  • Java
Expert 100
Count Scorecards
  • Java
Expert 100
Unfair Game
  • Java
Advanced 100
Oil Well
  • Java
Hard 100
Modify The Sequence
  • Java
Advanced 100
Divisible Numbers
  • Java
Expert 100
Ones and Twos
  • Java
Hard 100
Extremum Permutations
  • Java
Medium 100
Tree Pruning
  • Java
Advanced 100
P-sequences
  • Java
Hard 100
Best spot
  • Java
Advanced 100
Find the Seed
  • Java
Advanced 100
The Blacklist
  • Java
Advanced 100
Police Operation
  • Java
Hard 100
Road Maintenance
  • Java
Hard 100
King and Four Sons
  • Java
Expert 100
Counting the Ways
  • Java
Expert 100
Hard Disk Drives
  • Java
Expert 100
Travel around the world
  • Java
Medium 120
Robot
  • Java
Advanced 120
Vim War
  • Java
Advanced 120
Dortmund Dilemma
  • Java
Advanced 150
Separate the chocolate
  • Java
Expert 250

Constructive Algorithms

# Title Solution Time Space Difficulty Points Note
Lena Sort
  • Java
Medium 30
Flipping the Matrix O(n^2) O(n^2) Medium 30
Gaming Array
  • Java
Medium 35
New Year Chaos
  • Java
Medium 40
Bonetrousle
  • Java
Medium 50
Yet Another KMP Problem
  • Java
Hard 60
Beautiful 3 Set
  • Java
Hard 60
Inverse RMQ
  • Java
Hard 60
Two Subarrays
  • Java
Expert 70
Lovely Triplets
  • Java
Advanced 80
Array Construction
  • Java
Advanced 80

Bit Manipulation

# Title Solution Time Space Difficulty Points Note
Lonely Integer O(n) O(1) Easy 20
Maximizing XOR
  • Java
Easy 30
Counter game
  • Java
Medium 30
Xor-sequence
  • Java
Medium 40
Sum vs XOR O(n log(n)) O(1) Easy 20
The Great XOR
  • Java
Medium 25
Flipping bits
  • Java
Easy 40
Yet Another Minimax Problem
  • Java
Medium 30
Sansa and XOR
  • Java
Medium 30
AND Product
  • Java
Medium 40
Xoring Ninja
  • Java
Hard 55
Cipher
  • Java
Medium 50
XOR Matrix
  • Java
Hard 50
What's Next?
  • Java
Medium 50
String Transmission
  • Java
Hard 60
A or B
  • Java
Medium 50
Manipulative Numbers
  • Java
Hard 55
Stone game
  • Java
Hard 70
2's complement
  • Java
Advanced 70
Changing Bits
  • Java
Advanced 70
XOR key
  • Java
Advanced 80
Maximizing the Function
  • Java
Hard 70
XOR Subsequences
  • Java
Advanced 80
Iterate It
  • Java
Expert 90
Hamming Distance
  • Java
Expert 150
Mixing proteins
  • Java
Hard 80

Recursion

# Title Solution Time Space Difficulty Points Note
The Power Sum
  • Java
Easy 20
Crossword Puzzle
  • Java
Medium 30
Recursive Digit Sum
  • Java
Medium 30
Simplified Chess Engine
  • Java
Medium 40
Password Cracker
  • Java
Medium 40
Artithmetic Expressions
  • Java
Hard 40
K Factorization
  • Java
Hard 50
Bowling Pins
  • Java
Advanced 60
Simplified Chess Engine II
  • Java
Hard 60
Repetitive K-Sums
  • Java
Advanced 150

Game Theory

# Title Solution Time Space Difficulty Points Note
Game of Stones O(n) O(1) Easy 15
Tower Breakers
  • Java
Easy 15
A Chessboard Game
  • Java
Easy 15
Introduction to Nim Game
  • Java
Easy 15
Misère Nim
  • Java
Easy 20
Nimble Game
  • Java
Easy 20
Alice and Bob's Silly Game
  • Java
Medium 30
Poker Nim
  • Java
Easy 20
Tower Breakers, Revisited!
  • Java
Medium 25
Tower Breakers, Again!
  • Java
Medium 30
Zero-Move Nim
  • Java
Medium 50
Chessboard Game, Again!
  • Java
Medium 30
Digits Square Board
  • Java
Medium 35
Fun Game
  • Java
Medium 40
Stone Division
  • Java
Hard 50
Chocolate in Box
  • Java
Medium 70
Kitty and Katty
  • Java
Medium 80
Powers Game
  • Java
Medium 50
Deforestation
  • Java
Medium 50
Bob and Ben
  • Java
Medium 50
Tower Breakers - The Final Battle
  • Java
Medium 50
Simple Game
  • Java
Hard 60
Permutation game
  • Java
Medium 70
Move the Coins
  • Java
Hard 60
Play on benders
  • Java
Medium 70
New Year Game
  • Java
Medium 60
Stone Piles
  • Java
Hard 80
Chocolate Game
  • Java
Hard 90
Manasa and Prime game
  • Java
Hard 90
Vertical Rooks
  • Java
Medium 90
A stones game
  • Java
Medium 90
Tastes Like Winning
  • Java
Expert 100

NP Complete

# Title Solution Time Space Difficulty Points Note
Walking the Approximate Longest Path
  • Java
Hard 70
Sam's Puzzle (Approximate)
  • Java
Advanced 85
Spies, Revised
  • Java
Expert 100
TBS Problem
  • Java
Expert 100

Object Oriented Programming

# Title Solution Time Space Difficulty Points Note
Class vs. Instance N/A N/A Easy 30
Inheritance O(n) O(1) Easy 30
Abstract Classes N/A N/A Easy 30
Complex Numbers O(1) O(1) Easy 30

Arrays

# Title Solution Time Space Difficulty Points Note
Arrays - DS O(n) O(n) Easy 10
2D Array - DS O(1) O(1) Easy 15
Sparse Arrays O(n + q) O(n + q) Medium 25 n = number of input strings, q = number of queries
Dynamic Array O(q) O(n) Easy 15 q = Number of queries

Linked Lists

# Title Solution Time Space Difficulty Points Note
Print the Elements of a Linked List O(n) O(1) Easy 5
Reverse a Linked List O(n) O(1) Easy 5
Compare Two Linked Lists O(n) O(1) Easy 5
Delete a node O(n) O(1) Easy 5

Trees

# Title Solution Time Space Difficulty Points Note
Tree: Preorder Traversal O(n) O(n) Easy 10
Swap Nodes [Algo] O(n) O(n) Medium 40

Balanced Trees

# Title Solution Time Space Difficulty Points Note
Self Balancing Tree O(log(n)) O(n) Medium 50

Stacks

# Title Solution Time Space Difficulty Points Note
Maximum Element Push-O(1), Delete - O(n), Print - O(1) Push - O(1), Delete - O(1), Print - O(1) Easy 20
Balanced Brackets O(n) O(n) Medium 25

Queues

# Title Solution Time Space Difficulty Points Note
Queue using Two Stacks Enqueue - O(1), Dequeue - O(n), Print - O(n) Enqueue - O(1), Dequeue - O(1), Print - O(1) Medium 30

Heap

# Title Solution Time Space Difficulty Points Note
QHEAP1 Insert - O(log(n)), Delete - O(n), Print - O(1) Insert - O(1), Delete - O(1), Print - O(1) Easy 25

Disjoint Set

# Title Solution Time Space Difficulty Points Note
Spaceholder O(1) O(1) Easy 1

Multiple Choice

# Title Solution Time Space Difficulty Points Note
Data Structures MCQ 1 NA NA Hard 5
Data Structures MCQ 2 NA NA Hard 5
Data Structures MCQ 3 NA NA Hard 5

Trie

# Title Solution Time Space Difficulty Points Note
Contacts Add - O(L), Find - O(L) Add - O(L), Find - O(1) Medium 40 L = Length of a contact name

Advanced

# Title Solution Time Space Difficulty Points Note
Spaceholder O(1) O(1) Easy 1

Fundamentals

# Title Solution Time Space Difficulty Points Note
Leonardo's Prime Factors O(1) O(1) Easy 10