OneCoder Avatar
OneCodercoderli.com · 937 篇博文
🏷️

#LeetCode

73 篇博文

已为您筛选出所有包含「#LeetCode」标签的技术文章与算法真题

✕ 清除筛选,返回首页
算法与 LeetCode 专题 · 核心算法··2 分钟

LeetCode Rising Temperature

Problem Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates. For example, retur...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··7 分钟

LeetCode Implement Queue Using Stacks

Problem Implement the following operations of a queue using stacks. Example: Notes: You must use only standard operations of a stack -- which means only push to...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··3 分钟

LeetCode Power of Two

Problem Given an integer, write a function to determine if it is a power of two. Example 1: Example 2: Example 3: 判断一个整数是否是2的幂次方 <!--break-- Python3 分析 给出两种办法。一...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··2 分钟

LeetCode Invert Binary Tree

Problem Invert a binary tree. Example: 对树进行完全的左右节点交换 <!--break-- Python3 分析 很自然的想到了递归

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··7 分钟

LeetCode Implement Stack using Queue

Problem Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top(...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··4 分钟

LeetCode Contains Duplicate II

Problem Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the ab...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··3 分钟

LeetCode Contains Duplicate

Problem Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··5 分钟

LeetCode Reverse Linked List

Problem Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 即反转链表,建议采用递...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··4 分钟

LeetCode Isomorphic Strings

Problem Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··2 分钟

LeetCode Count Primes

Problem Description: Count the number of prime numbers less than a non-negative number, n. 即统计小于n的质数个数 <!--break-- Python3 分析 采用空间换时间的方式。否则会超时。

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··3 分钟

LeetCode Remove Linked List Elements

Problem Remove all elements from a linked list of integers that have value val. Example Given: 1 -- 2 -- 6 -- 3 -- 4 -- 5 -- 6, val = 6 Return: 1 -- 2 -- 3 -- 4...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··4 分钟

LeetCode Happy Number

Problem Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer,...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··4 分钟

LeetCode House Robber

Problem You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··2 分钟

LeetCode Tenth Line

Problem How would you print just the 10th line of a file? For example, assume that file.txt has the following content: Your script should output the tenth line,...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··2 分钟

LeetCode Delete Duplicate Emails

Problem Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. For example, after...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··2 分钟

LeetCode Valid Phone Number

Problem Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may a...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··3 分钟

LeetCode Number of 1 Bits

Problem Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit in...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··3 分钟

LeetCode Reverse Bits

Problem Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··5 分钟

LeetCode Rotate Array

Problem Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note:...

🧮 Algo数据结构与算法
算法与 LeetCode 专题 · 核心算法··2 分钟

LeetCode Nth Highest Salary

Problem Write a SQL query to get the nth highest salary from the Employee table. For example, given the above Employee table, the nth highest salary where n = 2...

🧮 Algo数据结构与算法