2017年12月14日

优雅的点

摘要: 网易2017校招: 小易有一个圆心在坐标原点的圆,小易知道圆的半径的平方。小易认为在圆上的点而且横纵坐标都是整数的点是优雅的,小易现在想寻找一个算法计算出优雅的点的个数,请你来帮帮他。例如:半径的平方如果为25优雅的点就有:(+/-3, +/-4), (+/-4, +/-3), (0, +/-5) 阅读全文

posted @ 2017-12-14 12:47 夜的第八章 阅读(146) 评论(0) 推荐(0) 编辑

2017年12月13日

container-with-most-water

摘要: 题目: Given n non-negative integers a1 , a2 , ..., an , where each represents a point at coordinate (i, ai ). n vertical lines are drawn such that the t 阅读全文

posted @ 2017-12-13 22:05 夜的第八章 阅读(140) 评论(0) 推荐(0) 编辑

查找链表中是否有环linked-list-cycle

摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 不使用额外空间:这里没有实例化一个对象,只是引用对象,所以不会开辟新内存空间 用 阅读全文

posted @ 2017-12-13 20:56 夜的第八章 阅读(133) 评论(0) 推荐(0) 编辑

reverse-integer

摘要: 题目: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you thought about this? Here are some good questi 阅读全文

posted @ 2017-12-13 20:38 夜的第八章 阅读(127) 评论(0) 推荐(0) 编辑

AVL树之 Java的实现

摘要: AVL树的介绍 AVL树是高度平衡的而二叉树。它的特点是:AVL树中任何节点的两个子树的高度最大差别为1。 上面的两张图片,左边的是AVL树,它的任何节点的两个子树的高度差别都<=1;而右边的不是AVL树,因为7的两颗子树的高度相差为2(以2为根节点的树的高度是3,而以8为根节点的树的高度是1)。 阅读全文

posted @ 2017-12-13 17:00 夜的第八章 阅读(753) 评论(0) 推荐(0) 编辑

2017年12月12日

single-number

摘要: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime comple 阅读全文

posted @ 2017-12-12 22:14 夜的第八章 阅读(157) 评论(4) 推荐(0) 编辑

Best Time to Buy and Sell Stock II

摘要: 题目: Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may c 阅读全文

posted @ 2017-12-12 21:55 夜的第八章 阅读(123) 评论(0) 推荐(0) 编辑

maximun-depth-of-binary-tree

摘要: 题目: 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 farthe 阅读全文

posted @ 2017-12-12 21:30 夜的第八章 阅读(202) 评论(0) 推荐(0) 编辑

minimun-depth-of-binary-tree

摘要: 题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest 阅读全文

posted @ 2017-12-12 21:14 夜的第八章 阅读(213) 评论(0) 推荐(0) 编辑

剑指offer--矩阵中的路径

摘要: 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。如果一条路径经过了矩阵中的某一个格子,则该路径不能再进入该格子。 例如 a b c e s f c s a d e e 矩阵中包含一条 阅读全文

posted @ 2017-12-12 20:32 夜的第八章 阅读(238) 评论(0) 推荐(0) 编辑

导航