上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 33 下一页
摘要: Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2016-04-20 04:45 周洋 阅读(198) 评论(0) 推荐(0) 编辑
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2016-04-20 04:23 周洋 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by upd 阅读全文
posted @ 2016-04-20 03:35 周洋 阅读(579) 评论(0) 推荐(0) 编辑
摘要: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2 阅读全文
posted @ 2016-04-19 23:20 周洋 阅读(258) 评论(0) 推荐(0) 编辑
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 前缀和的应用,很简单。 阅读全文
posted @ 2016-04-19 15:32 周洋 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 判断一个数是不是4的次方。 我们知道num & (num - 1)可以用来判断一个数是否为2的次方数,更进一步说,就是二进制表示下,只有最高位是1,那么由于是2的次方数,不一定是4的次方数,比如8,所以我们还要其他的限定条件,我们仔细观察可以发现,4的次方数的最高位的1都是计数位,那么我们只需与上一 阅读全文
posted @ 2016-04-18 16:05 周洋 阅读(627) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on 阅读全文
posted @ 2016-04-18 05:53 周洋 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 很简单的水题。把 阅读全文
posted @ 2016-04-18 05:36 周洋 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Merge k sorted linked lists and return it as one sorted list. 题意:把k个已经排好序的链表整合到一个链表中,并且这个链表是排了序的。 题解:这是一道经典好题,值得仔细一说。 有两种方法,假设每个链表的平均长度是n,那么这两种方法的时间复杂 阅读全文
posted @ 2016-04-18 05:25 周洋 阅读(3752) 评论(0) 推荐(0) 编辑
摘要: Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg 阅读全文
posted @ 2016-04-17 20:30 周洋 阅读(405) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 33 下一页