8. String to Integer (atoi)

class Solution:def myAtoi(self, s: str) -> int:return max(min(int(*re.findall('^[\+\-]?\d+', s.lstrip())), 2**31 - 1), -2**31)
class Solution:def myAtoi(self, s:str) -> int:return max(min(int(*re.findall('^[\+\-]?\d+', s.lstrip())), 2**31-1), -2**31)

Rotate List

C++

class Solution {
public:ListNode *rotateRight(ListNode *head, int k) {if (!head || k<=0){return head;}//find the length of Listint len=1;ListNode *p=head;while( p->next != NULL ){p = p->next;len++;}//connect the tail to headp->next = head;//find the left place (take care the case - k > len)k = len - k % len;//find the placefor(int i=0; i<k; i++){p = p->next;}//break the listhead = p->next;p->next = NULL;return head;}
};
class Solution{
public:ListNode *rotateRight(ListNode *head, int k){if (!head || k<=0){return head;}int len =1;ListNode *p = head;while( p -> next != NULL){p = p-> next;len++}//connect the tail to headp -> next =head;//find the left place(take care the case -k >len)k = len - k%len;//find the placefor (int i=0; I<k;i++){p = p-> next;}//break the listhead = p-> next;p -> next =NULL;return head;}
};

2021-08-17 String to Integet atoi, ratate list相关推荐

  1. (四十六:2021.08.17)《医疗物联网单导联心电波心房颤动检测研究》

    <医疗物联网单导联心电波心房颤动检测研究> 讲在前面 摘要 1.介绍 2.准备工作 2.1 符号 2.2 问题公式 2.3 便携式设备 2.4 数据库 2.5 性能评估算法 3.数据预处理 ...

  2. Go 1.17 RC2发布 | Gopher Daily (2021.08.03) ʕ◔ϖ◔ʔ

    每日一谚:Package name space is flat Go技术生态 Go 1.17 RC2发布 - https://groups.google.com/g/golang-announce/c ...

  3. Kotlin实现LeetCode算法题之String to Integer (atoi)

    题目String to Integer (atoi)(难度Medium) 大意是找出给定字串开头部分的整型数值,忽略开头的空格,注意符号,对超出Integer的数做取边界值处理. 方案1 1 clas ...

  4. 2021.03.17 pokémon小游戏开发记录与周总结

    2021.03.17 pokémon小游戏开发记录与周总结 此篇仅包含部分项目代码,只是个人的学习总结. 文章目录 2021.03.17 pokémon小游戏开发记录与周总结 前言 一.前期准备 二. ...

  5. 本博客导读(2021/08/09更新)

    文章目录 1. 简介 1.1 博客精神 1.2 写作目的 1.3 技术方向 1.4 博主 1.5 版权说明 2 推荐内容 2.1 主要代表作 2.2 其他推荐内容 3. 程序类 3.1 C#程序设计 ...

  6. [2021.1.17多校省选模拟4]T1(莫比乌斯反演/组合数学/枚举倍数)

    [2021.1.17多校省选模拟4]T1 一般人都会想着去枚举直线的斜率,但是枚举斜率之后就会产生多条直线,并且这些直线的长度不一,难以快速求解,所以我们考虑换一种方法枚举. 枚举最远点对的横纵坐标之 ...

  7. LeetCode算法入门- String to Integer (atoi)-day7

    LeetCode算法入门- String to Integer (atoi)-day7 String to Integer (atoi): Implement atoi which converts ...

  8. 【细节实现题】LeetCode 8. String to Integer (atoi)

    LeetCode 8. String to Integer (atoi) Solution1:我的答案 参考链接:http://www.cnblogs.com/grandyang/p/4125537. ...

  9. IO多路复用之epoll总结 http://www.cnblogs.com/Anker/archive/2013/08/17/3263780.html

    IO多路复用之epoll总结 http://www.cnblogs.com/Anker/archive/2013/08/17/3263780.html

  10. 2021.08.09【普及组】模拟赛C组比赛总结

    文章目录 2021.08.09[普及组]模拟赛C组比赛总结 写在前面: T1 :[普及模拟]生产武器 题目大意: 正解: T2 :[普及模拟]城市连接 题目大意: 正解: T3 :[普及模拟]抢救文件 ...

最新文章

  1. zookeeper3.4集群搭建
  2. 求点到直线的最短距离及垂足
  3. R语言:求二维变量数学期望
  4. pythonfor循环加2_python-for循环
  5. [转]讲解安装Ubuntu nfs配置系统
  6. Linux抓包工具tcpdump命令详解
  7. python中赋值运算符有哪些_Python代码中有哪些赋值运算符呢?
  8. python 无法引入同级目录的方法_再见 virtualenv!K神教你轻松管理多个Python环境...
  9. vue新版router.addRoute基础用法
  10. JavaWeb中的Servlet原理是什么?(存库,建议收藏)
  11. d3d 渲染遇到的几个问题
  12. 梦幻西游热门服务器卡顿延迟,Win10梦幻西游很卡反应很慢该如何处理
  13. 2017年全国大学生电子设计竞赛报告(F题)调幅信号处理实验电路
  14. 即席查询(Ad Hoc)入门(Kylin)
  15. 数据大屏之跑马灯功能
  16. 阿里 P9 揭秘职场晋升:明明一样做好了本职工作,只有我一直不被提拔?
  17. 几种查询局域网内在线弱电设备IP地址的方法,总有一款你会用的到
  18. 拼多多校招笔试题 避嫌抢劫
  19. Jacob实现文字转换语音
  20. 【漏洞复现】永恒之蓝 MS17-010 远程溢出漏洞(CVE-2017-0143)

热门文章

  1. 利用python进行数据加载和存储
  2. 全是干货:MBR分区结构以及GPT分区结构
  3. 记一次2048小游戏开发
  4. 程序员的恶性循环:加班-没空学习-老是写同等水平代码-无法提升代码质量-老是出BUG-老是需要修改-加班-......
  5. wifi×××破解的密码查看方式
  6. 我眼中的2011年互联网大事记
  7. Oracle中记录被锁解锁方法
  8. 联想式查单词-YourDict
  9. 2018湘南学院计算机分数线,湘南学院录取分数线2021是多少分(附历年录取分数线)...
  10. 温故知新----标签的语义化