随笔分类 - 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
阅读全文
摘要:Remove all elements from a linked list of integers that have value val. Example: 如果第一个数字,就需要删除,那么需要重置head。所以自己构建1个myHead。 Remove all elements from a l
阅读全文
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Example 2:
阅读全文
摘要:Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: 分析,因为是sorted的list。所以,重复的数字,会是连续的。 只需要
阅读全文
摘要: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:
阅读全文
摘要: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
阅读全文
摘要:https://leetcode.com/problems/move-zeroes/ https://medium.com/@rebeccahezhang/leetcode-283-move-zeroes-6e6c23380998 Given an array nums, write a funct
阅读全文
摘要:https://leetcode.com/problems/palindrome-linked-list/ https://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/ Given a s
阅读全文
摘要:https://leetcode.com/problems/reverse-linked-list/ https://www.geeksforgeeks.org/reverse-a-linked-list/ /** * Definition for singly-linked list. * pub
阅读全文