5 Comments
User's avatar
Kishan kumar's avatar

3. Count Even and Odd Numbers

Input array = [1, 2, 3, 4, 5, 6]

Output Even numbers = 3

Output Odd numbers = 3

Expand full comment
Kishan kumar's avatar

2. LCM of Two Numbers

Input a = 8, b = 14

Output LCM = 36

Expand full comment
Kishan kumar's avatar

1. HCF of Two Numbers

Input a = 24 , b = 36

Output = 12

Expand full comment
Sundram pal's avatar

1. Using only an addition , how do you add eight 8's and get the number 1000?

2. Sally is 54 years old and her mother is 80, how many years ago was Sally's mother times her age?

3. Which 3 numbers have the same answer whether they're added or multiplied together?

4. There is a basket containing 5 apple, how do you divide the apple among 5 children so that each child has 1 apple while 1apple remains in the basket?

Expand full comment
Piyush Maurya's avatar

1. Reverse an Array

Problem: Given an integer array, reverse it in-place without using extra array.

Example: Input: [1, 2, 3, 4, 5] Output: [5, 4, 3, 2, 1]

2. Find the Maximum Subarray Sum

Problem: Given an integer array (with positive and negative numbers),

find the contiguous subarray with the maximum sum. (Try Kadane's Algorithm)

Example: Input: [-2, 1, -3, 4, -1, 2, 1, -5, 4] Output: 6 Subarray: [4, -1, 2, 1]

3. Check for Balanced Parentheses

Problem: Given a string containing '( )', '{ }', '[ ]',

check if the parentheses are balanced.

Example: Input: "{[()()]}" Output: True

Input: "{[(])}" Output: False

Expand full comment