Four Problems in 10min
Challenge was to solve 4 LC problems (2 easy, 2 medium) in <= 10min. I picked the ones below, new ones, from today. Solutions might not be the most elegant and/or efficient, but they all passed. Code is down below, cheers, ACC. Solution to Problem #1: public class Solution { public int LongestSubarray(int[] nums) { Hashtable maxOnesAtPosition = new Hashtable(); bool insideOne = false; int beginPos = 0; for (int i = 0; i < nums.Length; i++) { if (nums[i] == 1 && !insideOne) { beginPos = i; ...