From a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 Mon Sep 17 00:00:00 2001 From: Jack Sangdahl Date: Fri, 27 Jun 2025 12:23:02 -0600 Subject: chore: remove old cpp and rust solutions --- other/simplify_path.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 other/simplify_path.cpp (limited to 'other/simplify_path.cpp') diff --git a/other/simplify_path.cpp b/other/simplify_path.cpp deleted file mode 100644 index 09852f3..0000000 --- a/other/simplify_path.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// 71. Simplify Path -#include "leetcode.h" - -// given a string 'path', which is an absolute path (starting with a slash) to a -// file or directory in a unix-style file system, convert it to the simplified -// canonical path - -class Solution { -public: - string simplifyPath(string path) { - vector stack; - string ans, tmp; - stringstream p(path); - while (getline(p, tmp, '/')) { - if (tmp == "" || tmp == ".") - continue; - if (!stack.empty() && tmp == "..") - stack.pop_back(); - else if (tmp != "..") - stack.push_back(tmp); - } - for (auto s : stack) - ans += "/" + s; - return stack.empty() ? "/" : ans; - } -}; - -int main() { - Solution obj; - cout << obj.simplifyPath("/home/") << endl; // expect: /home/ - cout << obj.simplifyPath("/../") << endl; // expect: / - cout << obj.simplifyPath("/home//foo/") << endl; // expect: /home/foo -} -- cgit v1.2.3