- 博客(4)
- 收藏
- 关注
原创 换种方式反转字符串
反转字符串一般的方式首位交换public void reverseString(char[] s) { for (int i = 0; i < s.length / 2; i++) { char temp = s[i]; s[i] = s[s.length - i - 1]; s[s.length ...
2019-07-28 13:54:23
184
原创 leetcode561题(时间复杂度为O(n)的解法)
leetcode561题数组拆分(时间复杂度为O(n)的解法)来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/array-partition-i题目描述给定长度为 2n 的数组, 你的任务是将这些数分成 n 对, 例如 (a1, b1), (a2, b2), …, (an, bn) ,使得从1 到 n 的 min(ai, bi) 总和最...
2019-07-26 13:44:16
384
原创 java实现图的遍历
图的遍历无向图的遍历图广度优先遍历深度优先遍历无向图的遍历图//用map和list存储图数据Map<Character, List> map = new HashMap<>();map.put('A', Arrays.asList('B', 'C'));map.put('B', Arrays.asList('A', 'C', 'D'));map.put('C...
2019-07-24 11:34:36
782
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅