diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/browser_history.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/browser_history.cpp')
-rw-r--r-- | other/browser_history.cpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/other/browser_history.cpp b/other/browser_history.cpp deleted file mode 100644 index df7d3cd..0000000 --- a/other/browser_history.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// 1472. Design Browser History -#include "leetcode.h" - -/* - * you have a browser of one tab where you start on the homepage and can visit - * another url, get back in the history number of steps or move forward in the - * history number of steps. implement BrowserHistory class (they're self - * explantory) - */ - -class BrowserHistory { -public: - BrowserHistory(string homepage) { curr = homepage; } - void visit(string url) { - h_forward = stack<string>(); - h_back.push(curr); - curr = url; - } - string back(int steps) { - while (--steps >= 0 && !h_back.empty()) { - h_forward.push(curr); - curr = h_back.top(); - h_back.pop(); - } - return curr; - } - string forward(int steps) { - while (--steps >= 0 && !h_forward.empty()) { - h_back.push(curr); - curr = h_forward.top(); - h_forward.pop(); - } - return curr; - } - -private: - stack<string> h_back, h_forward; - string curr; -}; - -int main() { - BrowserHistory *obj = new BrowserHistory("https.xyz"); - string param_2 = obj->back(1); - string param_3 = obj->forward(1); -} |