随笔分类 -  dataStructure

摘要:Source 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. E 阅读全文
posted @ 2022-08-07 14:43 凌雨尘 阅读(67) 评论(0) 推荐(0)
摘要:Source Problem Reverse a linked list from position m to n. Example Given 1->2->3->4->5->NULL, m = 2 and n = 4, return1->4->3->2->5->NULL. Note Given m 阅读全文
posted @ 2022-07-30 23:55 凌雨尘 阅读(49) 评论(0) 推荐(0)
摘要:Source Reverse a linked list. Example For linked list 1->2->3, the reversed linked list is 3->2->1 Challenge Reverse it in-place and in one-pass 题解1 - 阅读全文
posted @ 2022-07-03 13:36 凌雨尘 阅读(73) 评论(0) 推荐(0)
摘要:Source Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Example Given 21->10->4->5, tail connects to no 阅读全文
posted @ 2022-06-12 15:04 凌雨尘 阅读(46) 评论(0) 推荐(0)
摘要:Source Given a linked list, determine if it has a cycle in it. Example Given 21->10->4->5, tail connects to node index 1, return true Challenge Follow 阅读全文
posted @ 2022-05-08 13:28 凌雨尘 阅读(53) 评论(0) 推荐(0)
摘要:Source Given a linked list, remove the nth node from the end of list and return its head. Note The minimum number of nodes in list is n. Example Given 阅读全文
posted @ 2022-04-04 19:23 凌雨尘 阅读(34) 评论(0) 推荐(0)
摘要:Source Given two numbers represented by two linked lists, write a function that returns sum list. The sum list is linked list representation of additi 阅读全文
posted @ 2022-03-27 14:17 凌雨尘 阅读(40) 评论(0) 推荐(0)
摘要:Source You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that t 阅读全文
posted @ 2022-03-13 14:12 凌雨尘 阅读(52) 评论(0) 推荐(0)
摘要:Source Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preser 阅读全文
posted @ 2022-02-13 13:07 凌雨尘 阅读(74) 评论(0) 推荐(0)
摘要:Source Write a removeDuplicates() function which takes a list and deletes any duplicate nodes from the list. The list is not sorted. For example if th 阅读全文
posted @ 2022-01-09 12:04 凌雨尘 阅读(61) 评论(0) 推荐(0)
摘要:Source Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example Given 1 阅读全文
posted @ 2021-12-05 13:54 凌雨尘 阅读(49) 评论(0) 推荐(0)
摘要:Problem Description Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent differe 阅读全文
posted @ 2021-10-24 12:49 凌雨尘 阅读(82) 评论(0) 推荐(0)
摘要:Problem Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be pali 阅读全文
posted @ 2021-10-10 14:49 凌雨尘 阅读(51) 评论(0) 推荐(0)
摘要:Source Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant dig 阅读全文
posted @ 2021-09-19 15:10 凌雨尘 阅读(322) 评论(0) 推荐(0)
摘要:Source Ugly number is a number that only have factors 3, 5 and 7. Design an algorithm to find the Kth ugly number. The first 5 ugly numbers are 3, 5, 阅读全文
posted @ 2021-09-12 10:28 凌雨尘 阅读(73) 评论(0) 推荐(0)
摘要:Source Count the number of k's between 0 and n. k can be 0 - 9. Example if n=12, k=1 in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], we have FIVE 1's ( 阅读全文
posted @ 2021-08-22 14:16 凌雨尘 阅读(57) 评论(0) 推荐(0)
摘要:Source Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array. Find it. Examp 阅读全文
posted @ 2021-08-08 19:08 凌雨尘 阅读(49) 评论(0) 推荐(0)
摘要:Source Given an array of integers, the majority number is the number that occurs more than 1/3 of the size of the array. Find it. Example Given [1, 2, 阅读全文
posted @ 2021-07-18 10:38 凌雨尘 阅读(47) 评论(0) 推荐(0)
摘要:Source Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it. Example Given [1, 1 阅读全文
posted @ 2021-07-04 13:24 凌雨尘 阅读(89) 评论(0) 推荐(0)
摘要:Source Print numbers from 1 to the largest number with N digits by recursion. Example Given N = 1, return [1,2,3,4,5,6,7,8,9]. Given N = 2, return [1, 阅读全文
posted @ 2021-06-20 14:21 凌雨尘 阅读(56) 评论(0) 推荐(0)