2016年7月22日

设计Twitter的api

摘要: 355. Design Twitter 题意:设计Twitter的API,实现以下功能。 Example: 以下是我的实现代码 大致思路:全局的信息队列,按发布时间排序。全局的用户映射表,存用户信息,设计成hash表结构,便于快速获取用户。 阅读全文

posted @ 2016-07-22 17:42 _dshizhh 阅读(388) 评论(0) 推荐(0)

给一个表达式字符串加括号,计算它的所有的可能的值

摘要: 241. Different Ways to Add Parentheses 题意:Given a string of numbers and operators, return all possible results from computing all the different possib 阅读全文

posted @ 2016-07-22 14:47 _dshizhh 阅读(1273) 评论(0) 推荐(0)

判断一个整数是否是平方数

摘要: 367. Valid Perfect Square 题意:不用api,判断一个整数是否是平方数。 开始的想法是直接用二分法判断是否是平方数。 错误的代码: 第7行相乘会溢出,并且测试超时(应该就是溢出导致循环未停止)。 修改为以下代码,测试通过。 阅读全文

posted @ 2016-07-22 09:40 _dshizhh 阅读(799) 评论(0) 推荐(0)

导航