Giter Site home page Giter Site logo

leetcode's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

leetcode's Issues

cmake 报错: Unknown CMake command "gtest_discover_tests".

求问这是咋回事儿呀,没有找到gtest_discover_tests在哪儿,这一句是干嘛的呀

CMake Error at src/CMakeLists.txt:14 (gtest_discover_tests):
  Unknown CMake command "gtest_discover_tests".


-- Configuring incomplete, errors occurred!
See also "/home/ciruelas/code/repos/LeetCode/build/CMakeFiles/CMakeOutput.log".
See also "/home/ciruelas/code/repos/LeetCode/build/CMakeFiles/CMakeError.log".
./leetcode: line 30: ./findDuplicate: No such file or directory

链表定义的一个小错误

在最新的版本e40c3da
listnode.h文件的第28行:
ListNode(int x = 0, ListNode *p = nullptr) : val(x), next(nullptr){};
应该改成
ListNode(int x = 0, ListNode *p = nullptr) : val(x), next(p){};

关于链表的 double free 问题

您好,我在使用这个repo做链表题目的时候 leetcode problem 207 发现会出现 free(): double free detected in tcache 2 报错。我在代码里看到这样一段:

  // 是否删除链表
  // 某些题目中会使用两个链表,删除两次会出错
  // 开启后会造成内存泄漏
  void setRelease(bool release = true);

我试着用 valgrind 定位这个问题,发现如果 release = true, 则会多出 4 个 free 过程。而这个问题仅在测例为如下情况时才出现:

TEST(remove_linked_list_elements, remove_linked_list_elements_case3)
{
    Solution s;
    List in = {7, 7, 7, 7};
    List ans = {};
    int val = 7;
    // in.no_release();
    // ans.no_release();

    EXPECT_TRUE(is_same_list(s.removeElements(in.head, val), ans.head));
}

请问您是如何定位这个问题,并通过这种方式解决 double free 的?我尝试了一个晚上,没有丝毫头绪,希望得到您的回复!十分感谢!

TODO List

TODO List

  • List, Tree destroy
  • List, Tree compare
  • List, Tree print
  • Tutorial in doc
  • CI
  • Move solutions to other branches
  • Clear legacy files
  • Remove headers

更多的支持

看起来不支持二维数组,不同类型的vector的输入,有计划支持吗。
我的意思是,对于这种输入 [["#",".","#"]] 可以生成对应的vector<vector> 。
以及,此插件对于树和链表的打印似乎也没有。

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.