题目描述:
There are a total of n courses you have to take, labeled from 0 to n - 1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as ...
最后更新于 .
There are a total of n courses you have to take, labeled from 0 to n - 1.
Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as ...
最后更新于 .
Reverse a singly linked list.
Hint:
A linked list can be reversed either iteratively or recursively. Could you implement both?
单链表逆置
提示:
用递归和迭代方式分别实现。
链表基本操作,递归方式参考:https://leetcode.com/discuss/34474/in-place-iterative-and-recursive-java-solution
迭代版本:
# Definition for singly-linked list ...
最后更新于 .
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 of a character must be replaced with another character while preserving ...
最后更新于 .
Count the number of prime numbers less than a non-negative number, n
Hint: The number n could be in the order of 100,000 to 5,000,000.
References:
How Many Primes Are There? (https://primes.utm.edu/howmany ...
最后更新于 .
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 --> ...