注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
急需经验值看其他帖子,献上1-3月OA代码,写得很粗糙,仅供参考。OA通过了,可惜店面没过。。。
好心人给点大米555
时间问题:
package GoogleProblem;
import com.sun.tools.doclets.formats.html.SourceToHTMLConverter; import sun.util.resources.cldr.zh.CalendarData_zh_Hans_SG;
import java.util.HashSet; import java.util.Set;
public class TimeRealize { public static Set<String> perm1(String s) { Set<String> temp=new HashSet<>();//can not be added to the next function because of recursive return perm1("", s.substring(0,2)+s.substring(3),temp);//convey temp to the next recursive function } private static Set<String> perm1(String prefix, String s,Set<String> temp) { int n = s.length();
if (n == 0) { //System.out.println(prefix);//test only: need to be deleted temp.add(prefix); } else { for (int i = 0; i < n; i++) perm1(prefix + s.charAt(i), s.substring(0, i) + s.substring(i+1, n),temp); }
//System.out.println(temp.size()); for test return temp;
}
public static int stringToTime(String time){ if(time.charAt(2)==':') { return ((time.charAt(0) - '0') * 10 + (time.charAt(1) - '0')) * 60 + (time.charAt(3) - '0') * 10 + (time.charAt lt = date; //continue; } if(bloom[i] == 1 && i != index_pre+1) { index_pre = i; continues = 1; } } } if(K == continues){ result = date; } } return result; } public static void main(String[] args) { int[] input = {3,2,5,1,4}; int[] input2={}; int k = 1; System.out.println(latest(input, k)); }
}
|