Icecream parlor hackerrank solution

Problem name: Icecream Parlor

Judge: HackerRank

Problem link: Icecream Parlor | HackerRank

 

 

Ice cream parlor hackerrank solution


#include <iostream>

using namespace std;

int main() {
    int t;
    cin >> t;
    for (int x = 0; x < t; x++) {
        int m, n;
        cin >> m >> n;
        int flavor[n];
        for (int i = 0; i < n; i++) {
            cin >> flavor[i];
        }
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (flavor[i] + flavor[j] == m) {
                    cout << i + 1 << " " << j + 1 << "\n";
                    break;
                }
            }
        }
    }
    return 0;
} 








Tags: Ice cream parlor hackerrank solution, Ice cream parlor hackerrank solution in Java, Ice cream parlor hackerrank solution in C, Ice cream parlor hackerrank solution in C++, Ice cream parlor hackerrank solution in cpp, Ice cream parlor hackerrank solution in Python, Ice cream parlor hackerrank solution in JavaScript, Ice cream parlor hackerrank alogrithm

Next Post Previous Post
No Comment
Add Comment
comment url