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...
已为您筛选出所有包含「#LeetCode」标签的技术文章与算法真题
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...
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...
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 分析 给出两种办法。一...
Problem Invert a binary tree. Example: 对树进行完全的左右节点交换 <!--break-- Python3 分析 很自然的想到了递归
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(...
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...
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...
Problem Reverse a singly linked list. Example: Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 即反转链表,建议采用递...
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...
Problem Description: Count the number of prime numbers less than a non-negative number, n. 即统计小于n的质数个数 <!--break-- Python3 分析 采用空间换时间的方式。否则会超时。
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...
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,...
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...
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,...
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...
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...
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...
Problem Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return...
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:...
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...