Goki recently had a breakup, so he wants to have some more friends in his life. Goki has N people who he can be friends with, so he decides to choose among them according to their skills set Yi(1<=i<=n). He wants at least X skills in his friends.
Help Goki find his friends.
Example:
Input: n = 5, x = 100, arr = [110,130,90,100,45]
Output
YES YES NO YES NO
Approach
C++
#include <bits/stdc++.h>using namespace std;void gokiBreakup(int n, int x, int arr[]){for (int i = 0; i < n; i++){int y = arr[i];if (y >= x)cout << "YES\n";elsecout << "NO\n";}}int main(){int n = 5;int x = 100;int arr[] = {110, 130, 90, 100, 45};gokiBreakup(n, x, arr);return 0;}
No comments:
Post a Comment