Leetcode Easy Balanced Parentheses Validation - Java Problem Statement Given an string or expression which only consists of characters like (, ), [, ], {, } . Validate if the string has balanced parentheses. A string has balanced parentheses, if every open bracket has an associated closed one and they exist in the right order. Solution Explanation As
Frequently Asked Questions Calculate the Hamming Distance between two Integers Problem Statement Given two integers, calculate the hamming distance between them. Solution Explanation Hamming Distance between integers is defined as the number of indexes where the two bits differ. For example, given integers x = 2 and y=5, the hamming distance between them is,
Array Find Two Numbers in an Array Which Sum Up to K Problem Statement Given an array of integers, find out two indices such that the sum of the numbers at that indices matches K. For example, {4, 6, 8, 1, 9} and K = 15, the output would be [1,4] Solution Explanation The questions is
Linked List Check if a LinkedList has a cycle Problem Statement Given a single linked list, verify if the list has a cycle. A linked list has a cycle if a node's reference points back to an earlier node in the chain. Example: 1 -> 2 -> 3 -> 4
Array Best Time to Buy and Sell Stock Problem Statement Given an array 'stocks' in which each value at index 'i' is the stock price on day 'i', Find the maximum profit you can make by performing atmost one Buy and one Sell on these stock prices. Example 1: Input: [10, 1,
Interview Questions Add Binary Leetcode Problem Statement Given two binary strings, return their sum (also a binary string). For example,a = "11", b = "1" Return "100". Solution Explanation The question is very straightforward where you add two binary values in string form. Carry
Binary Search First Bad Version Leetcode Problem Statement Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to be bad. You are given an API bool isBadVersion(version) which will return whether version is bad.
Leetcode Easy Reverse a LinkedList Java Problem Statement Reverse a singly linked list. Given a single linked list, reverse it in place. Explanation Given a linked list like below, 1 -> 2 -> 3 -> 4 -> 5 We can use three pointers, to traverse through
Array Climbing Stairs Leetcode Problem Statement You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Given, there's stair case which can