-
8 Patterns Review For Successful Coding Interview
8 Patterns Review For Successful Coding Interview This is nothing but quick 5 min revision before going to interview. Visit https: https://codeandalgo.com for more such contents
-
Add to Array-Form of Integer
LeetCode Problem #989 Problem Statement The array-form of an integer num is an array representing its digits in left to right order. Given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k. Example 1: Input: num = [1,2,0,0], k = 34Output: [1,2,3,4]Explanation: 1200 + 34 = 1234 LOGIC We have 2 numbers lets say number_1 and number_2….
-
Two Sum
LeetCode#1 Problem Statement Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Golang code for Two sum JAVA CODE TWO SUM Version-1…
-
Water Bottles
1518. Water Bottles Problem Statement There are numBottles water bottles that are initially full of water. You can exchange numExchange empty water bottles from the market with one full water bottle. The operation of drinking a full water bottle turns it into an empty bottle. Given the two integers numBottles and numExchange, return the maximum number of water bottles you can drink. JAVA CODE Water…
-
N-th Tribonacci Number
Problem Statement 1137. N-th Tribonacci Number The Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. Given n, return the value of Tn. N-th Tribonacci Number JAVA CODE This problem is an extension of FIBONACCI NUMBER problem. Visit Previous Problem#3 Similar Questions
-
FIBONACCI NUMBER
Leetcode Problem #509 Problem statement The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, F(0) = 0F(1) = 1F(n) = F(n – 1) + F(n – 2), for n > 1. Given n, calculate F(n). JAVA CODE FIBONACCI NUMBER Recursion solution…
-
Power of 2
Leetcode Problem #231 Problem statement Given an integer n, return true if it is a power of two. Otherwise, return false. An integer n is a power of two, if there exists an integer x such that n == 2x. Power of 2 Why (n&(n−1))=0 correct ? How to use Bitwise Operator ? Operator Description Java C++. Python3 Golang Result Explanation & Bitwise AND…