摘要:
题目要求 Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second 阅读全文
摘要:
题目要求 Given an n-ary tree, return the preorder traversal of its nodes' values. 题目分析及思路 题目给出一棵N叉树,要求返回结点值的前序遍历。可以使用递归的方法做。因为是前序遍历,所以最开始就加入根结点的值。 python代 阅读全文
摘要:
题目要求 Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even. Sort the array so that whenever 阅读全文
摘要:
题目要求 We have an array A of integers, and an array queries of queries. For the i-th query val = queries[i][0], index = queries[i][1], we add val to A[i 阅读全文
摘要:
题目要求 A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcod 阅读全文
摘要:
题目要求 Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and colum 阅读全文
摘要:
题目要求 Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthe 阅读全文
摘要:
题目要求 On a N * N grid, we place some 1 * 1 * 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a tower of v 阅读全文
摘要:
题目要求 Given an n-ary tree, return the postorder traversal of its nodes' values. 题目分析及思路 题目给出一棵N叉树,要求返回结点值的后序遍历。可以使用递归的方法做。因为是后序遍历,所以最后加入根结点的值。 python代码 阅读全文
摘要:
题目要求 Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. 阅读全文