Solving Shortest Subarray with Sum at Least K in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

Example 1:

Input: A = [1], K = 1
Output: 1

Example 2:

Input: A = [1,2], K = 4
Output: -1

Example 3:

Input: A = [2,-1,2], K = 3
Output: 3

Note:

  1. 1 <= A.length <= 50000
  2. 1 <= K <= 10 ^ 9
  • 1 <= A.length <= 50000
  • 1 <= K <= 10 ^ 9

See the full details of the problem Shortest Subarray with Sum at Least K at LeetCode

Originally posted at: @github.com/halfrost/LeetCode-Go