
贪心
fxy流年无悔
不要留下太多遗憾
展开
-
力扣 12 整数转罗马数字
class Solution { public: string intToRoman(int num) { string res=""; int nums[]={1000,900,500,400,100,90,50,40,10,9,5,4,1}; string str[]={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"}; int i=0; wh...原创 2021-05-02 11:02:52 · 107 阅读 · 0 评论 -
贪心2-力扣-java
class Solution { public int maxProfit(int[] prices) { int pro=0,max=0; for(int i=0;i<prices.length-1;i++){ for(int j=i;j<prices.length;j++){ pro=prices[j]-prices[i]; if(pro>max)...原创 2020-05-20 12:03:47 · 130 阅读 · 0 评论 -
贪心1--力扣--java
class Solution { public int findContentChildren(int[] g, int[] s) { if(g==null||s==null) return 0; Arrays.sort(g); Arrays.sort(s); int i=0,j=0; while(i<g.length&&j<s.length){ if(g[...原创 2020-05-19 22:21:14 · 144 阅读 · 0 评论