zoukankan      html  css  js  c++  java
  • 单步调试调试leetcode代码

    单步调试调试leetcode代码

      LeetCode代码通过Playground获取调试代码,然后通过赋值代码到本地的Pycharm进行单步调试

    概述

      LeetCode有三种Playground:控制台Playground:链表(Linked list),树(Binary tree);前端程序:React。LeetCode里面的Playground调试只能通过stdin输入实例,执行调试之后直接就获得输入结果。通过复制粘贴Playground代码到Pycharm可以进行单步调试。不同的控制台Playground调试过程类似,本文以104. 二叉树的最大深度中的树(Binary tree)的控制台Playground和Pycharm进行单步执行从而调试自己写的代码。

    一、选择语言,输入调试代码

     

    二、通过Playground获取调试代码

     1、代码提交平台跳转到Playground

    2、复制粘贴Playground当中全部的代码

    三、通过Pycharm调试代码

    1、修改代码:ctr +R 将null全改成None

    2、设置断点,单击连接调试。在控制台输入测试实例(enter),进行单步调试。stdin实例中需要将null全改成None

    3、进行单步调试获取代码bug的位置并进行修改获得运行结果如下,具体运行过程在调试器中可以查看

    4、'str' object has no attribute 'decode'

    python3的不需要decode了,因为python3的str没有decode的这个属性了,直接删除!

    def stringToString(input):
    return input[1:-1].decode('string_escape')
    修改为:
    def stringToString(input):
    return input[1:-1]
     
  • 相关阅读:
    生产环境之Nginx高可用方案
    MySQL主从同步配置
    SpringBoot整合MyBatisPlus配置动态数据源
    循环有序数组,查找值
    数组任意取三个数中乘积最大值
    多线程输出123以及有序输出1-75
    有序数组取中值
    RocketMQ原理及源码解析
    docker基础常用命令
    项目常用命令
  • 原文地址:https://www.cnblogs.com/yinminbo/p/12050239.html
Copyright © 2011-2022 走看看