Tip 1: Focus on understanding the basics of any topic before jumping to the advanced level.
Tip 2: Spend more time thinking about the approach to a problem before jumping to the solution.
Tip 3: Consistency is key.
Tip 1: Make sure it's a one-pager with all the important things highlighted.
Tip 2: You should have in-depth knowledge of all the projects you have mentioned in your resume.

Split: The input string S is first split into parts (words) based on spaces.
Rearrange: For each part, you will create a new string by first taking all characters at even indices (0, 2, 4, ...) in the order they appear, and then appending all characters at odd indices (1, 3, 5, ...) in the order they appear.
Combine: The transformed parts are then joined back together with a single space between them to form the final output string.
Approach:
Take the input string.
Split the string if it contains multiple words (e.g., using split() function).
For each substring:
Extract characters at even indices (s[::2]).
Extract characters at odd indices (s[1::2]).
Combine both parts (either concatenate or interleave as required).
Join the results from all split parts to form the final output string.


The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:

You don't need to print anything. It has already been taken care of. Just implement the given function.
Create left max array (maxl):
For each index, store the maximum height from the left up to that index.
Create right max array (maxr):
For each index, store the maximum height from the right up to that index.
For each index:
Water at index = min(maxl[i], maxr[i]) − height[i].
Sum all water values to get the total trapped water.

If the character C is found in the string S, you should report both the index of its first occurrence and the index of its last occurrence.
If the character C is not found in the string S at all, you should indicate this.



1. Each student gets at least one book.
2. Each book should be allocated to only one student.
3. Book allocation should be in a contiguous manner.
Input: ‘n’ = 4 ‘m’ = 2
‘arr’ = [12, 34, 67, 90]
Output: 113
Explanation: All possible ways to allocate the ‘4’ books to '2' students are:
12 | 34, 67, 90 - the sum of all the pages of books allocated to student 1 is ‘12’, and student two is ‘34+ 67+ 90 = 191’, so the maximum is ‘max(12, 191)= 191’.
12, 34 | 67, 90 - the sum of all the pages of books allocated to student 1 is ‘12+ 34 = 46’, and student two is ‘67+ 90 = 157’, so the maximum is ‘max(46, 157)= 157’.
12, 34, 67 | 90 - the sum of all the pages of books allocated to student 1 is ‘12+ 34 +67 = 113’, and student two is ‘90’, so the maximum is ‘max(113, 90)= 113’.
We are getting the minimum in the last case.
Hence answer is ‘113’.
1) Check feasibility:
If k > n (students > books):
→ Return -1 (cannot give each student at least one book).
2) Define search space:
Low = max(arr)
(because one student must get the book with maximum pages)
High = sum(arr)
(one student takes all books)
We binary search on this range.
3) Binary search for the minimum possible maximum pages:
For a mid-value = possible max pages per student:
Check if allocation is possible:
Traverse the array
Accumulate pages for current student
If pages exceed mid → assign to next student
Count how many students are needed
If number of students required > k → mid is too small → search right half.
Else → mid is feasible → search left half.
4) Final answer: The minimum mid for which allocation is possible is the answer.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?