文章
102. Binary Tree Level Order Traversal
Givenabinarytree,returnthelevelordertraversalofitsnodes&39;values.(ie,fromlefttoright,levelbylevel).Forexample:<pre<codeG
PAT A1010 二分进制结合重点题
!clipboard.png(/img/bVboqAq?w1496&h821)这道题而可以说是比较难的一道题,如果采用常规遍历,会出现时长或者溢出的问题;示例中给出的思路很值得借鉴;个人通过该示例有以下几个不同理解:1.有时候两个不同进制的数对比,我们可以进行进制,转化十进制来进行比
【Leetcode】95~96 不同的二叉搜索树
Leetcode95不同的二叉搜索树II输入:3输出:<pre<code1,null,3,2,3,2,null,1,3,1,null,null,2,2,1,3,1,null,2,null,3</cod
143. Reorder List
GivenasinglylinkedlistL:L0→L1→…→Ln1→Ln,reorderitto:L0→Ln→L1→Ln1→L2→Ln2→…Youmaynotmodifythevaluesinthelist&39;snodes,onlynode
148. Sort List
SortalinkedlistinO(nlogn)timeusingconstantspacecomplexity.Example1:<pre<codeInput:4>2>1>3Output:1>2>3>4
PAT A1048 二分/two points
!clipboard.png(/img/bVboqiU?w1531&h797)简单的一道题,想到的有两种方法方法一:二分查找;由于是两个数和,所以我们从i1开始枚举,在剩下的i1~n序列中找到mai的数,是一个递增不重复序列的查找问题,之前二分法总结过,所以不再赘述;代
144. Binary Tree Preorder Traversal
Givenabinarytree,returnthepreordertraversalofitsnodes&39;values.Example:<pre<codeInput:1,null,2,31\2/3
PAT A1044 二分法
!clipboard.png(/img/bVboqfv?w1513&h794)这道题可以利用二分来做,其实个人觉得动态规划也可以;利用二分的前提条件就是该序列是一个不下降序列;所以我们可以先构建一个sum数组,存放1i的和值;当然题目中要计算ij子序列的值,其实这个可以利用sum
147. Insertion Sort List
Sortalinkedlistusinginsertionsort.!clipboard.png(/img/bVboplo?w300&h180)Agraphicalexampleofinsertionsort.Thepartialsortedlist(
150. Evaluate Reverse Polish Notation
EvaluatethevalueofanarithmeticexpressioninReversePolishNotation.Validoperatorsare,,,/.Eachoperandmaybeanintegeroranotherex
已加载文章中没有匹配内容,试试其他关键词或清空搜索。