WAP stands for Write A Program
Example 1:
Input: nums = [1,2,3,4]
Output: [24,12,8,6]
Example 2:
Input: nums = [-1,1,0,-3,3]
Output: [0,0,9,0,0]
Example 1:
Input: s = “abc”, t = “ahbgdc”
Output: True
Example 2:
Input: s = “axc”, t = “ahbgdc”
Output: False
A peak element is an element that is strictly greater than its neighbors.
Given an integer list nums, find a peak element, and return it. If the list contains multiple peaks, return all of them.
Example 1:
Input: nums = [1,2,3,1]
Output: 3
Example 2:
Input: nums = [1,2,1,3,5,6,4]
Output: 2, 6
Output: [10, 98, 12, 22, 3, 33, 21, 11]
Alex works at a clothing store. There is a large pile of socks that must be paired by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are.
For example, there are n=7 socks with colors ar = {1,2,1,2,1,3,2}. There is one pair of color 1 and one of color 2. There are three odd socks left, one of each color. The number of pairs is 2.
Input: l = [10, 20, 20, 10, 10, 30, 50, 10, 20]
Output: 3
Logic: Alex can match 3 pairs of socks i.e 10-10, 10-10, 20-20
while the left out socks are 50, 60, 20
Office:- 660, Sector 14A, Vasundhara, Ghaziabad, Uttar Pradesh - 201012, India