Remove all white spaces from a string
Given a string that may have white spaces, write code to remove all white spaces from than string. For example: Input String: “IT IS HOT OUTSIDE” Output String: “ITISHOTOUTSIDE” Input String: ” I T I S HOT ” Output String: “ITISHOT”
Maximum (or minimum) sum of subarray of size k
Given an array of n integers, find the sub-array of length k with maximum sum. For example, Input Array: {6, 4, 3, 5, 1, 9, 2} k:3 Output: 15 (sum of sub-array 5, 1, 9)
Consecutive numbers with sum equal to n
Given a positive integer n, print the consecutive numbers whose sum is equal to n. For example, n = 20 Output: 2, 3, 4, 5, 6 (because 2+3+4+5+6+7 = 20) n = 29 Output: 14, 15