Skip to content

Instantly share code, notes, and snippets.

@DongguemYoo
Created May 6, 2020 05:00
Show Gist options
  • Save DongguemYoo/0b780bb1b1ab202ba577237482884a2a to your computer and use it in GitHub Desktop.
Save DongguemYoo/0b780bb1b1ab202ba577237482884a2a to your computer and use it in GitHub Desktop.
코딩테스트 연습 예산.cs
//1분컷
using System;
public class Solution {
public int solution(int[] d, int budget)
{
int answer = 0;
Array.Sort(d);
for (int i = 0; i < d.Length; i++)
{
budget -= d[i];
if (budget >= 0)
answer++;
else
break;
}
return answer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment