Code-1-js

作者: 游荡的猫咪 | 来源:发表于2017-02-06 13:22 被阅读0次

Question 1:

Reverse digits of an integer.Example1:x = 123, return 321 Example2:x = -123, return -321

Note:

The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed integer overflows.


Answer:

 - method 1:

note:Math.abs, Math.pow;ps: 此方法用字符串处理,有点怪怪的~~但速度较快~~


- method 2 :

note:直接数据运算,但运行速度不够快~~

相关文章

  • Code-1-js

    Question 1: Reverse digits of an integer.Example1:x = 123...

网友评论

      本文标题:Code-1-js

      本文链接:https://www.haomeiwen.com/subject/kuzvuttx.html