From 9535c6bd478f8c4cf1bfc964a696642a42a42a58 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Thu, 23 Apr 2026 21:02:15 +0900 Subject: [PATCH] baekjoon 20260423 --- code_study/Baekjoon/c/2263.c | 35 +++++++++++++++++++++++++++++ code_study/Baekjoon/python/15740.py | 1 + 2 files changed, 36 insertions(+) create mode 100644 code_study/Baekjoon/c/2263.c create mode 100644 code_study/Baekjoon/python/15740.py diff --git a/code_study/Baekjoon/c/2263.c b/code_study/Baekjoon/c/2263.c new file mode 100644 index 0000000..37f89a6 --- /dev/null +++ b/code_study/Baekjoon/c/2263.c @@ -0,0 +1,35 @@ +#include + +int N, res_idx = 0; +int inOrderIdx[100001]; +int inOrder[100000]; +int postOrder[100000]; +int preOrder[100000]; + +void find(int in_start, int in_end, int post_start, int post_end) { + if(in_start > in_end || post_start > post_end) return; + + int root = postOrder[post_end]; + int root_idx = inOrderIdx[root]; + int left_size = root_idx - in_start; + + preOrder[res_idx++] = root; + find(in_start, root_idx - 1, post_start, post_start + left_size - 1); + find(root_idx + 1, in_end, post_start + left_size, post_end - 1); +} + +int main() { + scanf("%d",&N); + + for(int i=0; i