## String Construction - Google Top Interview Questions

You are given a list of strings strings where each string contains "A"s and "B"s. You are also given integers a and b. Return the maximum number of strings that can be constructed given that you can use at most a "A"s and at most b "B"s, without reuse. Constraints n ≤ 50 where n is the length of strings a, b ≤ 50 Example 1 Input strings = ["AABB", "AAAB", "A", "B"] a = 4 b = 2 Output 3 Explanation We can take these strings using 4 "A"s and 2 "B"s ["AAAB

## Sum of Three Numbers Less than Target - Google Top Interview Questions

Given a list of integers nums and an integer target, return the number of triples i < j < k that exist such that nums[i] + nums[j] + nums[k] < target. Constraints n ≤ 1,000 where n is the length of nums Example 1 Input nums = [-3, 5, 3, 2, 7] target = 9 Output 5 Explanation Here are the different triples' values: -3 + 5 + 3 = 5 -3 + 5 + 2 = 4 -3 + 3 + 2 = 2 -3 + 3 + 7 = 7 -3 + 2 + 7 = 6

## Sum of Three Numbers Sequel - Google Top Interview Questions

Given a list of integers nums and an integer k, find three distinct elements in nums, a, b, c, such that abs(a + b + c - k) is minimized and return the absolute difference. Constraints n ≤ 1,000 where n is length of nums. Example 1 Input nums = [2, 4, 25, 7] k = 15 Output 2 Explanation Taking [2, 4, 7] will get us closest to 15 and the absolute difference is abs(13 - 15) = 2.

## Sum of Three Numbers Trequel - Google Top Interview Questions

Given a list of positive integers nums, consider three indices i < j < k such that nums[i] ≤ nums[j] ≤ nums[k]. Return the maximum possible nums[i] + nums[j] + nums[k]. You can assume that a solution exists. Constraints 3 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [9, 1, 5, 3, 4] Output 8 Explanation We pick [1, 3, 4] for a total sum of 8

## Swap Characters Once to Minimize Differences - Google Top Interview Questions

You are given two lowercase alphabet strings s and t of the same length. Given that you can make at most one swap between two characters in s, return the minimum number of indices where s[i] ≠ t[i]. Constraints 1 ≤ n ≤ 100,000 where n is the length of s and t Example 1 Input s = "abbz" t = "zcca" Output 2 Explanation We can swap "a" and "z" to turn s into "zbba". Then there's 2 characters that differ between t. Example 2 Input s = "zfba" t = "zbca"