10056 - What is the Probability ?
🌕🌗🌑🌑🌑 # 題目連結 題目連結 Online Judge uDebug # 題目說明 Time limit: 3.000 seconds # 題目 Probability has always been an integrated part of computer algorithms. Where the deterministic algorithms have failed to solve a problem in short time, probabilistic algorithms have come to the rescue. In this problem...
more...402. Remove K Digits
⭐️⭐️⭐️ # 題目敘述 Given string num representing a non-negative integer num , and an integer k , return the smallest possible integer after removing k digits from num . # Example 1 Input: num = "1432219", k = 3 Output: "1219" Explanation: Remove the three digits 4, 3,...
more...950. Reveal Cards In Increasing Order
⭐️⭐️⭐️ # 題目敘述 You are given an integer array deck . There is a deck of cards where every card has a unique integer. The integer on the ith card is deck[i] . You can order the deck in any order you want. Initially, all the cards start face down (unrevealed) in one deck. You will do the following...
more...1700. Number of Students Unable to Eat Lunch
⭐️ # 題目敘述 The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers 0 and 1 respectively. All students stand in a queue. Each student either prefers square or circular sandwiches. The number of sandwiches in the cafeteria is equal to the number of students....
more...58. Length of Last Word
⭐️ # 題目敘述 Given a string s consisting of words and spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only. Substring A substring is a contiguous non-empty sequence of characters within a string. # Example 1 Input: s =...
more...41. First Missing Positive
⭐️⭐️⭐️⭐️ # 題目敘述 Given an unsorted integer array nums . Return the smallest positive integer that is not present in nums . You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space. # Example 1 Input: nums = [1,2,0] Output: 3 Explanation: The numbers in the range [1,2] are...
more...442. Find All Duplicates in an Array
⭐️⭐️⭐️ # 題目敘述 Given an integer array nums of length n where all the integers of nums are in the range [1, n] and each integer appears once or twice, return an array of all the integers that appears twice. You must write an algorithm that runs in O(n) time and uses only constant extra space. #...
more...143. Reorder List
⭐️⭐️⭐️ # 題目敘述 You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → … You may not modify the values in the list's nodes. Only nodes themselves may be...
more...234. Palindrome Linked List
⭐️ # 題目敘述 Given the head of a singly linked list, return true if it is a palindrome or false otherwise. palindrome A palindrome is a sequence that reads the same forward and backward. # Example 1 Input: head = [1,2,2,1] Output: true # Example 2 Input: head = [1,2] Output: false ListNode 的...
more...