![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OJ
Zijie Tian
我爱好c++
展开
-
1102 Invert a Binary Tree (25分)
The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck off.Now it's your turn to...原创 2020-01-31 09:08:15 · 238 阅读 · 0 评论 -
1045 Favorite Color Stripe (30分)
Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts...原创 2020-01-04 14:30:55 · 241 阅读 · 0 评论 -
1040 Longest Symmetric String (25分)
Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you ...原创 2020-01-02 22:18:03 · 167 阅读 · 0 评论 -
1038 Recover the Smallest Number (30分)
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0229...原创 2020-01-02 20:52:34 · 101 阅读 · 0 评论 -
PAT1032 Sharing
To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,...原创 2020-01-01 18:08:31 · 137 阅读 · 0 评论 -
常用技巧----离散化
这个技巧比较常用,当处理数据比较大,但是又不是很需要去关心数据的具体数值,而只需要去关心相对位置时会很有用(因为很多题目的数据范围会很大,但给的数据点却很少,或者这个数据范围是连续的时候)比如 -2000000 200 600 -4000 600 2000000这种输入,要对其进行离散化,先对其进行排序,然后用unique进行去重,之后所对应的序号便是离散化后的数据。#include <...原创 2020-01-01 15:04:24 · 198 阅读 · 0 评论