Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randhir200/pair-less-than-k
You are given an array A of N integers, and an integer K. Find the maximum value of S, such S that S = a[i] + a[j], and S < K. If no such value exists, then print -1. Refer the sample test case for better understanding. Input The first line of the input contains T, the number of test cases. The first line of each test case contains N, the number of elements in the array. The next line contains N space separated integers, denoting the values in the array. The next line contains the value K. Constraints 1 <= T <= 10 1 <= N <= 10^4 1 <= A[i] <= 10^4
https://github.com/randhir200/pair-less-than-k
Last synced: 1 day ago
JSON representation
You are given an array A of N integers, and an integer K. Find the maximum value of S, such S that S = a[i] + a[j], and S < K. If no such value exists, then print -1. Refer the sample test case for better understanding. Input The first line of the input contains T, the number of test cases. The first line of each test case contains N, the number of elements in the array. The next line contains N space separated integers, denoting the values in the array. The next line contains the value K. Constraints 1 <= T <= 10 1 <= N <= 10^4 1 <= A[i] <= 10^4
- Host: GitHub
- URL: https://github.com/randhir200/pair-less-than-k
- Owner: Randhir200
- Created: 2022-04-22T03:13:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-22T03:31:51.000Z (over 2 years ago)
- Last Synced: 2024-11-06T03:46:56.032Z (about 2 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files: