MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Hackerrank_problems/Bigger is Greater/solution2.cpp:19–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17vector<string> st;
18
19int main() {
20 string c;
21 int numberOfTestCases;//number of test cases
22 cin >> numberOfTestCases;
23 for (int i = 0; i < numberOfTestCases; i++) {
24 string s;
25 cin >> s;
26 st.push_back(s);
27 }
28 for (int i = 0; i < numberOfTestCases; i++) {
29 string tmp = st[i];
30 string answer;
31 do {
32 next_permutation(st[i].begin(), st[i].end()); // for sorting
33 if (tmp < st[i])
34 answer = st[i];
35 tmp = st[i];
36
37 } while (st[i] != tmp);
38
39 if (answer.empty())
40 cout << "no answer" << endl;
41 else
42 cout << answer << endl;
43 }
44 return 0;
45}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected