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…
Browsing: Easy
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…
Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear…
A bit flip of a number x is choosing a bit in the binary representation of x and flipping it from either 0 to 1 or 1 to 0. Given two integers start and goal, return the minimum number of bit flips to…
Given a doubly linked list. Your task is to reverse the doubly linked list and return its head. Here’s the [Problem Link] to…
Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked…