2018年3月9日

订单模块

摘要: 功能介绍: 前台功能: 1.创建订单 controller层实现: 传入userId和收货地址shippingId,由后台自动创建订单。 1 @RequestMapping("create.do") 2 @ResponseBody 3 public ServerResponse create(Htt 阅读全文

posted @ 2018-03-09 21:00 二十年后20 阅读(328) 评论(0) 推荐(0) 编辑

69.Sqrt(x)

摘要: 题目链接:https://leetcode.com/problems/sqrtx/description/ 题目大意:实现求平方根。 法一:直接库函数。代码如下(耗时39ms): 1 public int mySqrt(int x) { 2 double res = Math.sqrt(x); 3 阅读全文

posted @ 2018-03-09 15:39 二十年后20 阅读(183) 评论(0) 推荐(0) 编辑

28.Implement strStr()---kmp

摘要: 题目链接:https://leetcode.com/problems/implement-strstr/description/ 题目大意:字符串匹配,从字符串中,找到给定字符串第一次出现的位置下标,并返回。 法一:暴力,两个for循环,逐一比较每一个可能的字符串,一旦找到,则返回。代码如下(耗时5 阅读全文

posted @ 2018-03-09 11:05 二十年后20 阅读(113) 评论(0) 推荐(0) 编辑

26.Remove Duplicates from Sorted Array

摘要: 题目链接:https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/ 题目大意:删除有序数组中重复的数值。 法一:利用27题的法一,保留不重复的值,记录留下的数组值的下标。代码如下(耗时13ms): 1 阅读全文

posted @ 2018-03-09 09:43 二十年后20 阅读(98) 评论(0) 推荐(0) 编辑

27.Remove Element---两指针

摘要: 题目链接:https://leetcode.com/problems/remove-element/description/ 题目大意:给出一个数组和一个值,从数组中删除与当前值相等的值,并将数组长度返回,最终数组中元素的顺序可以不保持原顺序,也就是允许排序。 法一:反向思考,不直接删除值,而是将不 阅读全文

posted @ 2018-03-09 09:11 二十年后20 阅读(107) 评论(0) 推荐(0) 编辑

导航