Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <string>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. vector<int> solution(vector<int> prices) {
  7. vector<int> answer;
  8. for (int i = 0; i < prices.size(); i++)
  9. {
  10. int cnt = 0;
  11. for (int j = i + 1; j < prices.size(); j++)
  12. {
  13. cnt++;
  14. if (prices[i] > prices[j]) break;
  15. }
  16. answer.push_back(cnt);
  17. }
  18. return answer;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement