wasPrime
  • Home
  • Archives
  • Categories
  • Tags
  • About

Design a data structure with O(1) time complexity for all functions

Probelm DescriptionDesign a data structure with O(1) time complexity for all functions: set(key, value) get(key) set_all(value) SolutionFor the general solution, the time complexity of the function
2023-12-10
system_design
#system_design

Sequence Count

Problem DescriptionEnglishA sequence is defined as: the absolute value of the difference between two adjacent elements after ordering is exactly equal to 1.Now given an array of length n, how many sub
2023-09-10
algorithm > design
#algorithm #design #sliding_window

Balance All Numbers into Range

Basic ProblemIf we have a number array and a desired range of values, we have chance to operate a pair of numbers every time with multiple times - we are able to give a number a plus and give another
2023-09-07
algorithm > design
#algorithm #design #greedy_algorithm

LeetCode 83 - Remove Duplicates from Sorted List

Difficulty: easy Problem DescriptionEnglish (Remove Duplicates from Sorted List)Given the head of a sorted linked list, delete all duplicates such that each element appears on
2023-06-19
algorithm > leetcode > linked_list
#algorithm #leetcode #linked_list #easy #two_pointers

LeetCode 92 - Reverse Linked List II

Difficulty: medium Problem DescriptionEnglish (Reverse Linked List II)Given the head of a singly linked list and two integers left and right where left <= right, reverse th
2023-06-18
algorithm > leetcode > linked_list
#algorithm #leetcode #linked_list #medium #two_pointers

LeetCode 160 - Intersection of Two Linked Lists

Difficulty: easy Problem DescriptionEnglish (Intersection of Two Linked Lists)Given the heads of two singly linked-lists headA and headB, return the node at which the two list
2023-06-17
algorithm > leetcode > linked_list
#algorithm #leetcode #linked_list #easy #two_pointers

LeetCode 142 - Linked List Cycle II

Difficulty: medium Problem DescriptionEnglish (Linked List Cycle II)Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null.
2023-06-16
algorithm > leetcode > linked_list
#algorithm #leetcode #linked_list #medium #two_pointers

LeetCode 25 - Reverse Nodes in k-Group

Difficulty: hard Problem DescriptionEnglish (Reverse Nodes in k-Group)Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.
2023-06-15
algorithm > leetcode > linked_list
#algorithm #leetcode #linked_list #hard

LeetCode 24 - Swap Nodes in Pairs

Difficulty: medium Problem DescriptionEnglish (Swap Nodes in Pairs)Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without m
2023-06-14
algorithm > leetcode > linked_list
#algorithm #leetcode #linked_list #medium

LeetCode 141 - Linked List Cycle

Difficulty: easy Problem DescriptionEnglish (Linked List Cycle)Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a lin
2023-06-13
algorithm > leetcode > linked_list
#algorithm #leetcode #linked_list #easy #two_pointers
123…9

Search

Hexo Fluid