摘要:
思路: 先判定符号,整型范围[-2^32,2^32] 取余除10操作,依次进行,越界返回0 Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321#defi... 阅读全文
摘要:
思路:利用map >做值和指针的映射,最后将指针按值依次链接起来,时间复杂度O(N),空间O(N) Merge k sorted linked lists andreturn it as one sorted list. Analyze and describ... 阅读全文
摘要:
寻找一个数的数根,用了暴力破解的方式,时间复杂度比较高 暂未想到O(1)的方式Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.Fo... 阅读全文
摘要:
字符串转整型,更新之后的leetcode题,需考虑各种情况, 测试过标准库的atoi函数,当字符串越界返回的值是错的, 而该题要求越界时的返回边界值,更加严谨。Implement atoi to convert a string to an integer.Hint: Carefu... 阅读全文