The cost of a stock on each day is given in an array. Each day, you can either buy one share, sell any number of shares that you own, or not make any transaction at all.
You are given an infinite 2d grid with the bottom left cell referenced as (1,1). All the cells contain a value of zero initially. Let’s play a game?
The game consists of N steps wherein each step you are given two integers a and b.
You’re given the maximum speed of N cars in the order they entered the long straight segment of the circuit. Each car prefers to move at its maximum speed. If that’s not possible because of the front car being slow, it might have to lower its speed. It still moves at the fastest possible speed while avoiding any collisions.
Tomya like a positive integer p, and now she wants to get a receipt of Ciel’s restaurant whose total price is exactly p. Note that the i-th menu has the price 2i-1 (1 ≤ i ≤ 12). Find the minimum number of menus whose total price is exactly p.
You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents your maximum jump length at that position.
This problem could be solved in O(N) time complexity, where N is the maximum of the given two strings length. We could start traversing the two strings from the last and keep calculating the sum of each string’s character ie ‘0’ and ‘1’. If there’s a carry propagate it to the sum of the next digits in iteration.
Given a NxN matrix with 0s and 1s. A block with value 1 can be used to travel ahead in the matrix. Now, consider mat[0][0] as the starting point for the rat.