Python Programming Questions
1. Rotate List Left by K Positions
Write a function that rotates a list to the left by k positions without using extra space.
2. Maximum Sum of Subarrays of Size 3
Find the maximum sum among all contiguous subarrays of size 3 in a given list.
3. Check if One String is Rotation of Another
Write a function to check if one string is a rotation of another.
Example: Input: "waterbottle" and "erbottlewat" → Output: True
4. Count Swaps in Bubble Sort
Modify bubble sort to return the number of swaps performed to sort a list.
Example: Input: [5, 1, 4, 2, 8] → Output: 5
5. Find All Pairs with Given Sum
Use a set to find all unique pairs in a list that sum up to a given value.
Example: Input: [1, 5, 7, -1, 5], target = 6
6. Generate All Substrings
Generate all substrings of a given string.
Example: Input: 'aababcdb'
7. Sum of boundary elements in a given matrix.
8. Print right angle triangle pattern.
9. Print Elements of a List in Reverse Order - Write a recursive function that prints elements
of a list in reverse order. Example: print_reverse([1, 2, 3, 4]) → 4 3 2 1