DSA problem solution: Climbing stairs
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
Author:
Shivam Srivastava
|
Saturday, January 07, 2023
|
No comments
|
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.
Example 1:
Input: nums = [-6,1,3,5,9,11], target = 9
Output: 4
Explanation: 9 exists in nums and its index is 4
Author:
Shivam Srivastava
|
Monday, December 26, 2022
|
No comments
|
Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].
The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.
Example 1:
Input: nums = [1,2,3,4]
Output: [24,12,8,6]