• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2016年2月4日
Groupon面经:Find paths in a binary tree summing to a target value
摘要: You are given a binary tree (not necessarily BST) in which each node contains a value. Design an algorithm to print all paths which sum up to that val 阅读全文
posted @ 2016-02-04 12:02 neverlandly 阅读(618) 评论(0) 推荐(0)
Groupon面经Prepare: Max Cycle Length
摘要: 题目是遇到偶数/2,遇到奇数 *3 + 1的题目,然后找一个range内所有数字的max cycle length。对于一个数字,比如说44,按照题目的公式不停计算,过程是 44, 22, 11, 8, 9 ,1(瞎起的),从44到1的这个sequence的长度,叫做cycle length。然后题 阅读全文
posted @ 2016-02-04 05:21 neverlandly 阅读(596) 评论(0) 推荐(0)
Groupon面经Prepare: Sort given a range && Summary: Bucket Sort
摘要: 首先是如何sort一个只有0和1的数组,要求inplace. follow up是告诉一个range,如何在O(N)时间内sort好 两个pointer可解 1 package Sorting; 2 import java.util.*; 3 4 public class InplaceSortin 阅读全文
posted @ 2016-02-04 01:27 neverlandly 阅读(372) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3