
剑指offer
刷题
Rico-Coding
资本要靠自己积累 技术需要自己磨炼
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
2021-02-26
调整数组顺序使奇数位于偶数前面 class Solution { public int[] exchange(int[] nums) { int i = 0, j = nums.length - 1, tmp; while(i < j) { while(i < j && (nums[i] & 1) == 1) i++; while(i < j && (nums[j原创 2021-02-26 19:12:58 · 115 阅读 · 0 评论 -
2.23
40. 最小的k个数 class Solution { public int[] getLeastNumber(int[] arr,int k){ int []vec=new int[k]; if(k==0){ return vec; } PriorityQueue<Integer> queue = new PriorityQueue<Integer>(new Comparator<Integer>() { public i原创 2021-02-23 23:07:45 · 107 阅读 · 0 评论 -
2.21
24 反转链表 class Solution { public ListNode reverseList(ListNode head){ if(head==null || head.next==null){ return head; } ListNode node=reverseList(head.next); head.next.next=head; head.next=null; return node; } } 3 数组中重复的数字 查找任意一个出现超过一次的原创 2021-02-21 21:12:33 · 97 阅读 · 0 评论