2019年7月17日
摘要: 问题描述: 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. Example: N 阅读全文
posted @ 2019-07-17 14:13 狂奔的蜗牛163 阅读(138) 评论(0) 推荐(0) 编辑
  2019年7月16日
摘要: 问题描述: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Follow up:Could you do it without 阅读全文
posted @ 2019-07-16 15:06 狂奔的蜗牛163 阅读(194) 评论(0) 推荐(0) 编辑
  2019年7月15日
摘要: 问题描述: Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: 思路: 二叉树的问题,首先考虑递归算法,用深度优先搜索。 为了体现模块化思想,一般讲 阅读全文
posted @ 2019-07-15 19:54 狂奔的蜗牛163 阅读(212) 评论(0) 推荐(0) 编辑
  2019年7月11日
摘要: 问题描述: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wik 阅读全文
posted @ 2019-07-11 07:42 狂奔的蜗牛163 阅读(254) 评论(0) 推荐(0) 编辑
  2019年7月9日
摘要: 问题描述: 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 occ 阅读全文
posted @ 2019-07-09 16:27 狂奔的蜗牛163 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 问题描述: Count the number of prime numbers less than a non-negative number, n. Example: 思路: 1、最暴力的方法就是循环遍历,用两个for循环嵌套实现,但是整个代码运行时间太长,提交通不过 2、采用'Sieve of 阅读全文
posted @ 2019-07-09 10:13 狂奔的蜗牛163 阅读(233) 评论(0) 推荐(0) 编辑
  2019年7月3日
摘要: 问题描述: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopp 阅读全文
posted @ 2019-07-03 16:10 狂奔的蜗牛163 阅读(158) 评论(0) 推荐(0) 编辑
  2019年7月1日
摘要: 问题描述: Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Example 2: Note: Try to come up as many solutions 阅读全文
posted @ 2019-07-01 08:55 狂奔的蜗牛163 阅读(169) 评论(0) 推荐(0) 编辑
  2019年6月30日
摘要: 问题描述: Given an integer n, return the number of trailing zeroes in n!. Example 1: Example 2: Note: Your solution should be in logarithmic time complexi 阅读全文
posted @ 2019-06-30 15:10 狂奔的蜗牛163 阅读(232) 评论(0) 推荐(0) 编辑
  2019年6月25日
摘要: 问题描述: Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer poswhich represents the 阅读全文
posted @ 2019-06-25 08:42 狂奔的蜗牛163 阅读(224) 评论(0) 推荐(0) 编辑