28 views
23 Jan 2026
Count subarrays whose sum is an even number - How do you provide the mathematical logic to count combinations by tracking the parity (odd/even) of the prefix sum?...
4 views
23 Jan 2026
Finding the maximum difference of RR[j] - RR[i] where j > i - logic to update the max difference while tracking the minimum element?...
9 views
23 Jan 2026
Find equilibrium index in array where left sum = right sum - Approach to detect balance point by maintaining running sum?...
3 views
23 Jan 2026
Find the smallest subarray whose sum is greater than or equal to the given value - Two pointer sliding window expansion/shrink decision logic?...
2 views
23 Jan 2026
Inversion counting in an array (how many times the larger element comes before the smaller one) - logic for counting integrals using merge sort modification?...
3 views
23 Jan 2026
Find the longest subarray whose sum is equal to a - Mechanism to find matching sums by prefix sum and hashmap it?...
2 views
23 Jan 2026
Trapping Rainwater Problem - Logic to calculate water level at each position while maintaining left max and right max?...
3 views
23 Jan 2026
Calculate minimum swaps to sort an array - mathematical approach to cycle detection and swap counting?...
3 views
23 Jan 2026
Finding majority element in array that appears no/more than 2 times - How does the logic of count increment/decrement work while maintaining candidates?...
3 views
23 Jan 2026
Find the subarray whose sum is maximum (Kadne's logic) - What is the intuition for resetting when the current sum is negative and why?...
3 views
23 Jan 2026
Finding leader elements in an array (those greater than the subelements on their right side) - what is the logic behind scanning from right to left?...
3 views
23 Jan 2026
Tracking the maximum element in a sliding window of size k - Efficient approach to updating the max as the window slides?...
3 views
23 Jan 2026
The array is to be arranged in a zig-zag pattern: small-large-small-large - condition to swap adjacent elements by adding them?...
5 views
23 Jan 2026
Finding packs in array (element greater than both of its neighbors) - different logic for boundary conditions and middle elements?...
3 views
23 Jan 2026
Merging two sorted arrays into a third sorted array - two pointer approach followed by comparison and selection logic?...
3 views
23 Jan 2026
The array contains product precedences, you need to apply a discount: 10% on the first 5 items, 5% on the rest - how do you handle the conditional discount logic?...
3 views
23 Jan 2026
It's a binary array (0 and 1), you need to find the length of the maximum consecutive 1s - when will the counter reset logic be applied?...
3 views
23 Jan 2026
How to access next element in circular array with wraparound - modelo operator trick of index calculation by doing that?...
2 views
23 Jan 2026
The array needs to be divided into two equal parts such that the sums of both parts are almost equal - what would be the strategy to find the partition point?...
3 views
23 Jan 2026
Array contains numbers, you need to find the difference of adjacent elements and store it in a new array - how will you implement the pattern RR[i+1] - RR[i]?...
3 views
23 Jan 2026
An array containing distances stored in kilometers, needs to convert them all to miles (1 km = 0.621 miles) - systematic way to apply the formula?...
2 views
23 Jan 2026
There is rainfall data of 30 days in array, find out on which day maximum rainfall occurred and what was that value-logic of tracking both maximum value and index?...
4 views
23 Jan 2026
I want to divide the array into two parts - the first half containing even numbers and the second half containing odd numbers - how do I approach the partitioning logic?...
3 views
23 Jan 2026
There is an array of lottery numbers and the user entered his number, check whether he won or not - how will you implement the basic logic of linear search?...
5 views
23 Jan 2026
The array contains a number of items, the user needs to specify a budget and check how many items they can afford - the logic to maintain a running shoe?...
12 views
23 Jan 2026
There are some numbers in an array and you need to find out whether all the numbers are same or different - how do you design comparison logic from the first element?...
9 views
21 Jan 2026
Suppose a student has entered the marks for their six subjects into an array. What will happen if they accidentally enter the marks for a seventh subject as well? Will the program crash, or something ...
5 views
21 Jan 2026
When initializing an array, if I write `int arr[5] = {10, 20, 30}`, what values will be stored in the remaining two elements, and how does the compiler handle this?...
3 views
21 Jan 2026
If I want to store the salaries of 100 employees in my program, should I create 100 separate variables or use an array? What problems might arise with each approach?...
3 views
21 Jan 2026
When we declare an array in C language, such as int numbers[10],
how exactly is it stored in memory, and how does each element get its memory address?...