Giter Site home page Giter Site logo

leetcode-debugger's Introduction

LeetCode-Debugger

A simple and crappy LeetCode problems debugger.

How to Use

  • Copy the LeetCode problem's input and paste it into s1 in main.cpp
  • Specify the input type and the output type (inType and outType)
  • Code your Solution in Solution.h
  • Call your Solution class in main.cpp, the program will automatically output the result.

Supported I/O Type

  1. int (e.g. Problem 7)
  2. vector<int> (e.g. Problem 1)
  3. vector<vector<int>> (e.g. Problem 54)
  4. vector<string> (e.g. Problem 539)
  5. ListNode* (e.g. Problem 2)
  6. Doubly Linked List (Node*) (OUTPUT SUPPORT ONLY e.g. haven't found yet)
  7. string (e.g. Problem 6)
  8. Binary Tree (TreeNode*) (e.g. Problem Offer 32)
  9. Binary Tree (TreeNode*) (An alternative way: Manually set the input tree's pre-order traversal as s1 and in-order traversal as s2)

Examples

Problem 1 (link)

inType = "vector<int>", outType = "vector<int>";
s1 = "[2,7,11,15]";
vecOut = sol->twoSum(vecIn, 9);
Output: 
[0,1]

Direct Output vector<string>

inType = "vector<string>", outType = "vector<string>"
s1 = R"(["abcde","12345"])"; // use R to avoid using '\'
vecStrOut = vecStrIn;
Output:
["abcde","12345"]

Direct Output a Binary Tree

To create a binary tree as shown below:

Binary Tree

inType = "TreeNode*", outType = "TreeNode*";
s1 = "[5,3,1,0,2,4,6,8,7]";
s2 = "[0,1,2,3,4,5,6,7,8]";
treeOut = treeIn;
Output:
5
3,6
1,4,null,8
0,2,null,null,7,null
null,null,null,null,null,null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.