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/binary_tree_zigzag.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 other/binary_tree_zigzag.cpp (limited to 'other/binary_tree_zigzag.cpp') diff --git a/other/binary_tree_zigzag.cpp b/other/binary_tree_zigzag.cpp deleted file mode 100644 index 186a99f..0000000 --- a/other/binary_tree_zigzag.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// 103. Binary Tree Zigzag Level Order Traversal -#include "leetcode.h" -// given the 'root' of a binary tree, return the zigzag level order traversal of -// its nodes' values (ie. from left to right, then right to left for the next -// level) - -class Solution { -public: - vvd zigzagLevelOrder(TreeNode *root) { - if (!root) - return {}; - queue q; - vvd ans; - q.push(root); - int level = 0; - while (!q.empty()) { - int sz = q.size(); - vector curr(sz); - for (int i = 0; i < sz; i++) { - TreeNode *tmp = q.front(); - q.pop(); - if (level == 0) - curr[i] = tmp->val; - else - curr[sz - i - 1] = tmp->val; - if (tmp->left) - q.push(tmp->left); - if (tmp->right) - q.push(tmp->right); - } - ans.push_back(curr); - level = !level; - } - return ans; - } -}; -- cgit v1.2.3