Geek is going for a training program for n days. He can perform any of these activities: Running, Fighting, and Learning Practice. Each activity…
Browsing: Data Structures & Algorithms
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money…
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money…
Given an integer array height[] where height[i] represents the height of the i-th stair, a frog starts from the first stair and wants to reach the top. From any…
Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal…
Problem Statement You need to implement a queue using an array (Python list works as an array here). The queue should support…
You need to implement a stack using an array (Python list works as an array here). The stack should support two main…
You are climbing a staircase with n steps. It takes n steps to reach the top. Each time you can either climb 1 or…
Given a non-negative integer n, your task is to find the nth Fibonacci number. The Fibonacci sequence is a sequence where the next term is the…
Consider a rat placed at position (0, 0) in an n x n square matrix mat[][]. The rat’s goal is to reach the…