方法很多,可以自己写实现也可以使用 String 或 StringBuffer/StringBuilder 中 的方法。有一道很常见的面试题是用递归实现字符串反转,代码如下所示: public static String reverse(String originStr) { if(originSt ...
分类:
其他好文 时间:
2020-07-05 15:16:33
阅读次数:
77
一.对象类 @Data @AllArgsConstructor public class User { private Integer age; private String name; } 二.普通写法 private List<User> users =Arrays.asList(new Use ...
分类:
编程语言 时间:
2020-07-05 15:07:27
阅读次数:
252
[实现ArrayList重新排序:我们可以用下面的代码来实现ArrayList重新排序:Collections.reverse(aList);示例:ArrayList aList = new ArrayList(); //Add elements to ArrayList object aList.... ...
分类:
编程语言 时间:
2020-07-05 13:38:49
阅读次数:
59
springmvc的参数绑定有以下几种方法: 1)默认的参数绑定 Request Response Session Model(实现ModelMap) 2)简单类型参数绑定 方法的形参上(Integer id,String,Double,Boolean) 3)pojo类型 4)包装类型 QueryV ...
分类:
编程语言 时间:
2020-07-05 00:23:48
阅读次数:
73
public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> result = new ArrayList<>(); if(nums.length < 3)return result; Arrays.sort(nums); ...
分类:
其他好文 时间:
2020-07-04 22:39:06
阅读次数:
63
02-线性结构3 Reversing Linked List (25分) Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. Fo ...
分类:
其他好文 时间:
2020-07-04 22:36:18
阅读次数:
69
题目:输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。 示例 1: 输入:head = [1,3,2] 输出:[2,3,1] 通过率: 代码: var reversePrint = function(head) { let result = []; if(head==null){ ...
分类:
Web程序 时间:
2020-07-04 21:11:24
阅读次数:
80
给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。 示例 1: 输入: "(()"输出: 2解释: 最长有效括号子串为 "()"示例 2: 输入: ")()())"输出: 4解释: 最长有效括号子串为 "()()" 链接:https://leetcode-cn.com ...
分类:
其他好文 时间:
2020-07-04 20:26:33
阅读次数:
49
反转一个单链表。 示例: 输入: 1->2->3->4->5->NULL输出: 5->4->3->2->1->NULL进阶:你可以迭代或递归地反转链表。你能否用两种方法解决这道题? 来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/reverse- ...
分类:
其他好文 时间:
2020-07-04 19:05:28
阅读次数:
59
Description Given an array of integers cost and an integer target. Return the maximum integer you can paint under the following rules: The cost of pai ...
分类:
其他好文 时间:
2020-07-04 16:59:34
阅读次数:
73