摘要:题目:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, g...
阅读全文
摘要:题目:Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired byt...
阅读全文
摘要:题目: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 ...
阅读全文
摘要:题目:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like...
阅读全文
摘要:题目:Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest...
阅读全文
摘要:题目:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3...
阅读全文