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/valid_stack_seq.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 other/valid_stack_seq.cpp (limited to 'other/valid_stack_seq.cpp') diff --git a/other/valid_stack_seq.cpp b/other/valid_stack_seq.cpp deleted file mode 100644 index 62250db..0000000 --- a/other/valid_stack_seq.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// 946. Validate Stack Sequences -#include "leetcode.h" - -/* - * given two integer arrays 'pushed' & 'popped' each with distinct - * values, return true if this could have been the result of a sequence - * of push and pop operations on an initially empty stack, or false otherwise - */ - -class Solution { -public: - bool validateStackSequences(vector &pushed, vector &popped) { - stack s; - int i = 0; - for (int x : pushed) { - s.push(x); - while (s.size() && s.top() == popped[i]) { - s.pop(); - i++; - } - } - return !s.size(); - } -}; - -int main() { - Solution obj; - vector pushed = {1, 2, 3, 4, 5}; - vector p1 = {4, 5, 3, 2, 1}, p2 = {4, 3, 5, 1, 2}; - printf("%d\n", obj.validateStackSequences(pushed, p1)); // expect: 1 - printf("%d\n", obj.validateStackSequences(pushed, p2)); // expect: 0 -} -- cgit v1.2.3