Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randhir200/masai-numbers-game
You are given an array A of N integers. Now, two functions F(X) and G(X) are defined: F(X) : This is the smallest number Z such that X < Z <= N and A[X] < A[Z] G(X) : This is the smallest number Z such that X < Z <= N and A[X] > A[Z] Now, you need to find for each index i of this array G(F(i)) , where 1 <= i <= N. If such a number does not exist, for a particular index i, output -1 as its answer. If such a number does exist, output A[G(F[i])]
https://github.com/randhir200/masai-numbers-game
Last synced: 2 days ago
JSON representation
You are given an array A of N integers. Now, two functions F(X) and G(X) are defined: F(X) : This is the smallest number Z such that X < Z <= N and A[X] < A[Z] G(X) : This is the smallest number Z such that X < Z <= N and A[X] > A[Z] Now, you need to find for each index i of this array G(F(i)) , where 1 <= i <= N. If such a number does not exist, for a particular index i, output -1 as its answer. If such a number does exist, output A[G(F[i])]
- Host: GitHub
- URL: https://github.com/randhir200/masai-numbers-game
- Owner: Randhir200
- Created: 2022-05-30T14:38:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-30T14:38:40.000Z (over 2 years ago)
- Last Synced: 2024-11-06T03:46:56.614Z (about 2 months ago)
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0