上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 29 下一页

2018年1月30日

leetcode 205. Isomorphic Strings

摘要: 求两字符串是否同构。即每个字符可且仅可映射为一个字符(包括自己),若两字符串经过某映射相同,则同构。 朴素的解法是保存其映射值和被映射值。 其实只要保存布尔值即可,巧妙。 阅读全文

posted @ 2018-01-30 14:22 willaty 阅读(78) 评论(0) 推荐(0) 编辑

leetcode 203. Remove Linked List Elements

摘要: 删除链表中某个元素。 要么直接删,要么值覆盖。算法题就不用free了。 阅读全文

posted @ 2018-01-30 14:13 willaty 阅读(78) 评论(0) 推荐(0) 编辑

leetcode 202. Happy Number

摘要: 一个数,是否为happy number,取每一位求平方和,得出结果继续,如果结果为1则为happy number。 阅读全文

posted @ 2018-01-30 13:05 willaty 阅读(119) 评论(0) 推荐(0) 编辑

leetcode 198. House Robber

摘要: 给定一系列整数,取整数,相邻不能取。 解法有二: 动态规划: 求差: 取last = nk - n(k - 1) + n(k - 2) - n(k - 3)...,当遍历到当前元素时,做差,如果结果为正数,则取;否则置0(相当于断开)。 而上式和sum求和除二等于相邻元素和。 阅读全文

posted @ 2018-01-30 13:04 willaty 阅读(121) 评论(0) 推荐(0) 编辑

leetcode 191. Number of 1 Bits

摘要: 统计bit中1的个数。与一下即可。 阅读全文

posted @ 2018-01-30 10:49 willaty 阅读(107) 评论(0) 推荐(0) 编辑

leetcode 190. Reverse Bits

摘要: 将32位反转。 也可以用bitset。 阅读全文

posted @ 2018-01-30 00:30 willaty 阅读(89) 评论(0) 推荐(0) 编辑

2018年1月29日

leetcode 189. Rotate Array

摘要: 前进k步,k可能大于数组。 。。。 阅读全文

posted @ 2018-01-29 23:22 willaty 阅读(88) 评论(0) 推荐(0) 编辑

leetcode 183. Customers Who Never Order

摘要: select Name as Customers from Customers where Id not in (select CustomerId from Orders); 阅读全文

posted @ 2018-01-29 23:11 willaty 阅读(81) 评论(0) 推荐(0) 编辑

leetcode 182. Duplicate Emails

摘要: 找出重复的数据。 阅读全文

posted @ 2018-01-29 23:08 willaty 阅读(98) 评论(0) 推荐(0) 编辑

leetcode 181. Employees Earning More Than Their Managers

摘要: 直接写也行 阅读全文

posted @ 2018-01-29 23:01 willaty 阅读(107) 评论(0) 推荐(0) 编辑

上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 29 下一页

导航