摘要: 题意 整数反转, 即个位变最高位, 最高位变个位; 同时, 翻转后溢出则不考虑 模拟样例 123 > 321 2147483647 --> 0; 翻转后溢出了 代码 class Solution { public: int reverse(int x) { int ans = 0; while (x 阅读全文
posted @ 2022-03-21 21:53 Figure_at_a_Window 阅读(26) 评论(0) 推荐(0)
摘要: 题意 使用指定的hash函数,返回给定字符串s第一个长度为k的hash值 = 给定hashVal的子串的下标。 方法 hashNew=val(s[first])+power∗(hashNow−val(s[last])∗power^(k−1) 代码 class Solution { public: i 阅读全文
posted @ 2022-01-31 22:57 Figure_at_a_Window 阅读(40) 评论(0) 推荐(0)