随笔分类 -  LeetCode

摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list -- head = [4,5,1,9], wh 阅读全文
posted @ 2019-03-11 13:06 ChuckLu 阅读(161) 评论(0) 推荐(0) 编辑
摘要:Remove all elements from a linked list of integers that have value val. Example: 如果第一个数字,就需要删除,那么需要重置head。所以自己构建1个myHead。 Remove all elements from a l 阅读全文
posted @ 2019-03-10 12:48 ChuckLu 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Example 2: 阅读全文
posted @ 2019-03-09 14:39 ChuckLu 阅读(114) 评论(0) 推荐(0) 编辑
摘要:Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: 分析,因为是sorted的list。所以,重复的数字,会是连续的。 只需要 阅读全文
posted @ 2019-03-09 13:15 ChuckLu 阅读(162) 评论(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. Example: 阅读全文
posted @ 2019-03-05 13:08 ChuckLu 阅读(126) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/reverse-string/ Write a function that reverses a string. The input string is given as an array of characters char[]. Do 阅读全文
posted @ 2019-02-26 13:00 ChuckLu 阅读(143) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/move-zeroes/ https://medium.com/@rebeccahezhang/leetcode-283-move-zeroes-6e6c23380998 Given an array nums, write a funct 阅读全文
posted @ 2019-02-25 19:04 ChuckLu 阅读(156) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/palindrome-linked-list/ https://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/ Given a s 阅读全文
posted @ 2019-02-25 01:26 ChuckLu 阅读(171) 评论(0) 推荐(0) 编辑
摘要:https://leetcode.com/problems/reverse-linked-list/ https://www.geeksforgeeks.org/reverse-a-linked-list/ /** * Definition for singly-linked list. * pub 阅读全文
posted @ 2019-02-22 13:16 ChuckLu 阅读(129) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示