Skip to content

Only Code

Eat Code Sleep – repeat

  • Github
  • 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
  • Github
  • 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: Mathematics

Nim’s Game | Code Implementation

Nim’s game is played with a set of heaps, each containing a certain number of objects or stones. Two players take turns removing objects from the heaps

Competitive Programming, Mathematics

Custom Randomize | Generate Integers with Equal Probability

Given a function foo(), that returns an integer between 1 and 5 with equal probability. Write a function using foo() that returns an integer between 1 and 7.

Interview Questions, Mathematics

Reservoir Sampling

Reservoir sampling is a category of randomised algorithms for choosing a simple random sample, without replacement, of k items

Algorithms, Interview Questions, Mathematics

Generate Pythagorean Triples

Given an integer limit, generate all Pythagorean Triples with values smaller than limit.

Interview Questions, Mathematics

Minimum Moves to Equal Array Elements – LeetCode Solution [Medium]

When we increment n – 1 elements, the relative difference between the highest number and all other numbers effectively decreases by 1.

Arrays, Competitive Programming, Mathematics

Line Problem Solution | CodeChef [Easy]

Consider the 2D grid formed by integer points on the XY Plane. The position of the Sniper and the Target are lattice points in this grid. The bullet shot by the Sniper will follow a straight line trajectory from (x1, y1) to (x2, y2). The bullet goes no further than (x2, y2).

Competitive Programming, Mathematics

Lucy and Flowers | HackerRank Solution [Medium]

The number of possible Binary Search Trees with n keys is Catalan Number (Cn). You could learn about Catalan Number & Binomial Coefficient.

Competitive Programming, Dynamic Programming, Mathematics

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

Sherlock and MiniMax | HackerRank Solution [Hard]

Given an integer range, for all M in that inclusive range, determine the minimum – abs(arr[i]-M) for all i

Arrays, Competitive Programming, Mathematics

Posts pagination

< 1 2 3 4 >
  • Algorithms
  • Arrays
  • Backtracking & Recursion
  • Breadth First Search (BFS)
  • C/C++
  • Competitive Programming
  • Computer Science
  • Data Science
  • Databases
  • Depth First Search (DFS)
  • Divide and Conquer
  • Dynamic Programming
  • Graphs
  • Greedy approach
  • Hashmaps
  • Heaps
  • Interview Questions
  • Java
  • Linked Lists
  • Machine Coding Questions
  • Machine Learning
  • Mathematics
  • Networking
  • Programming Projects
  • Python
  • Queues
  • Sorting
  • Special Data Structures
  • Stacks
  • Trees
  • Web Development
© 2025 Only Code | Aureolls
Exit mobile version