Skip to content

Only Code

Eat Code Sleep – repeat

  • Home
  • Arrays
  • Linked Lists
  • Trees
  • Stacks
  • Queues
  • Heaps
  • Graphs
  • Algorithms
    • Sorting
    • Dynamic Programming
    • Divide and Conquer
    • Backtracking & Recursion
    • Greedy approach
    • Breadth First Search (BFS)
    • Depth First Search (DFS)

Only Code

Eat Code Sleep – repeat

Close menu
  • Home
  • Arrays
  • Linked Lists
  • Trees
  • Stacks
  • Queues
  • Heaps
  • Graphs
  • Algorithms
    • Sorting
    • Dynamic Programming
    • Divide and Conquer
    • Backtracking & Recursion
    • Greedy approach
    • Breadth First Search (BFS)
    • Depth First Search (DFS)

Only Code

Eat Code Sleep – repeat

Search Toggle menu

Category: Algorithms

Program for Nth Catalan Number

Catalan numbers (Cn) are a sequence of natural numbers. Nth Catalan number has applications in many counting problems.

Competitive Programming, Dynamic Programming, Mathematics

How to calculate Binomial Coefficient (nCr) in O(r) time complexity

The recomputations in calculating binomial coefficient (nCr) can be avoided by exploiting optimal substructure and overlapping subproblems

Competitive Programming, Dynamic Programming, Mathematics

Array Manipulation | HackerRank Solution [Hard]

Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in the array.

Arrays, Competitive Programming, Sorting

Palindrome Index | HackerRank Solution [Easy]

Given a string of lowercase letters in the range ascii[a-z], determine the index of a character that can be removed to make the string a palindrome

Competitive Programming, Greedy approach

PacMan – DFS | HackerRank Solution [Easy]

Print all the nodes that you encounter while printing DFS tree. Then, print the distance ‘D’ between the source ‘P’ and the destination ‘.’

Competitive Programming, Depth First Search (DFS)

nCr table | HackerRank Solution [Medium]

Jim is doing his discrete maths homework which requires him to repeatedly calculate nCr(n choose r) for different values of n

Dynamic Programming, Mathematics

Common Child | Algorithms | HackerRank Solution [Medium]

Given two strings p and q of equal length, what’s the longest string that can be constructed such that it is a child of both?

Dynamic Programming

Counting Bits O(n) Solution – LeetCode [Easy] | Brian Kernighan’s Algorithm

Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.

Algorithms, Competitive Programming, Mathematics

Substring Diff | HackerRank (Algorithms) | Longest Common Substring

Given two strings and an integer, determine the length of the longest common substrings of the two strings that differ in no more than k positions.

Competitive Programming, Dynamic Programming

Hotel Bytelandia Solution

Hotel Bytelandia Solution – A number of guests have made reservations. Each reservation consists of an arrival time, and a departure time

Competitive Programming, Greedy approach

Posts navigation

< 1 2 3 … 6 >
  • Algorithms
  • Arrays
  • Backtracking & Recursion
  • Breadth First Search (BFS)
  • C/C++
  • Competitive Programming
  • Databases
  • Depth First Search (DFS)
  • Divide and Conquer
  • Dynamic Programming
  • Graphs
  • Greedy approach
  • Hashmaps
  • Heaps
  • Interview Questions
  • Java
  • Linked Lists
  • Machine Learning
  • Mathematics
  • Networking
  • Python
  • Queues
  • Sorting
  • Special Data Structures
  • Stacks
  • Trees
  • Web Development
© 2023 Only Code.