![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
刷题
lllllll_sssss
这个作者很懒,什么都没留下…
展开
-
LeetCode--38.外观数列
题目 题解 1、for循环检查 public static String countAndSay2(int n) { if(n==1){ return "1"; } StringBuffer ans = new StringBuffer("1"); StringBuffer temp = new StringBuffer(); for(int i=1;i<n;i++){ ..原创 2021-10-15 13:35:12 · 88 阅读 · 0 评论 -
LeetCode--069.山峰数组的顶部
题目 题解 //for循环实现 public static int peakIndexInMountainArrayFor(int[] arr) { int max = 0; int index = 0; for(int i=0;i<arr.length;i++){ if(max <= arr[i]){//只需要遍历到最大值即可 max = arr[i];原创 2021-10-14 21:52:35 · 602 阅读 · 0 评论 -
LeetCode--11.盛最多水的容器
题目 题解 //两个for循环进行计算,时间复杂度高(On^2),无法提交,计算超时。 private static int maxAreaFor(int[] height) { int maxArea = 0; for(int i=0;i<height.length;i++){ for(int k=i+1;k<height.length;k++){ int temp = (k-i)*Ma原创 2021-10-13 14:40:15 · 66 阅读 · 0 评论 -
LeetCode--175.组合两个表
题目 题解tijia //查询所有用户的地址信息,使用左链接 select p.FirstName, p.LastName, a.City, a.State from Person p left join Address a on p.PersonId = a.PersonId 提交结果原创 2021-10-13 10:36:54 · 64 阅读 · 0 评论 -
LeetCode--412.fizz-buzz
题目 题解 class Solution { public List<String> fizzBuzz(int n) { List<String> list = new ArrayList<String>(); for(int i=1;i<=n;i++){ if(i%15 == 0){ //公倍数 list.add("FizzBuzz");原创 2021-10-13 10:32:23 · 90 阅读 · 0 评论 -
LeetCode--29.两数相除
题目 解题方案 1、采用直接想减的方式进行处理 //直接相减,在leetCde中无法提交,提示超时 public static int divide(int dividend, int divisor){ int quotient = 0; boolean postiveNumber = true; if((dividend>0 && divisor<0) || (dividend<0 &&原创 2021-10-12 16:41:09 · 91 阅读 · 0 评论