摘要: My first solution - using ArrayList: class MyCircularDeque { List<Integer> list = new ArrayList<>(); int k ; public MyCircularDeque(int k) { this.k = 阅读全文
posted @ 2022-03-31 06:49 阳光明媚的菲越 阅读(15) 评论(0) 推荐(0) 编辑
摘要: My first solution: class Solution { public int[] plusOne(int[] digits) { int n = digits.length; int carry = 1; for(int i=n-1;i>=0;i--){ int digit = di 阅读全文
posted @ 2022-03-31 04:13 阳光明媚的菲越 阅读(263) 评论(0) 推荐(0) 编辑
摘要: Using binary search, time complexity: O(log(x)) class Solution { public int mySqrt(int x) { int l=1, r =x; while(l<r-1){ int mid=l+(r-l)/2; int temp = 阅读全文
posted @ 2022-03-31 01:01 阳光明媚的菲越 阅读(19) 评论(0) 推荐(0) 编辑