目前分類:LeetCode (40)

瀏覽方式: 標題列表 簡短摘要

876. Middle of the Linked List

Given the head of a singly linked list, return the middle node of the linked list.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

283. Move Zeroes

Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

202. Happy Number

Write an algorithm to determine if a number n is happy.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

136. Single Number

Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

下周要面試了,程式考C,只好緊急刷題來喚醒跟C語言的回憶。

刷題列表參考:LeetCode面試必刷總復習題  | Tech Interview Prep

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

328. Odd Even Linked List

Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

92. Reverse Linked List II

Example 1:

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

225. Implement Stack using Queues

Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and empty).

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

148. Sort List

Given the head of a linked list, return the list after sorting it in ascending order.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

142. 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.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

141. Linked List Cycle

Given head, the head of a linked list, determine if the linked list has a cycle in it.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

160. Intersection of Two Linked Lists

Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

876. Middle of the Linked List

Given the head of a singly linked list, return the middle node of the linked list.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

206. Reverse Linked List

Given the head of a singly linked list, reverse the list, and return the reversed list.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

21. Merge Two Sorted Lists

You are given the heads of two sorted linked lists list1 and list2.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

There is an integer array nums sorted in ascending order (with distinct values).

Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 <= k < nums.length) such that the resulting array is [nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]] (0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2].

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.

Return the single element that appears only once.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

If target is not found in the array, return [-1, -1].

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad.

Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to be bad.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well.

You must not use any built-in exponent function or operator.

文章標籤

yoruru 發表在 痞客邦 留言(0) 人氣()

«12