Skip to content

Latest commit

 

History

History
123 lines (62 loc) · 4.19 KB

File metadata and controls

123 lines (62 loc) · 4.19 KB

ProgramCode

Leetcode、剑指 offer等笔试题集合

SwordtoOffer

ReConstructBinaryTree:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。

QueueByStack:用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。

RotateArray:把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。 输入一个非减排序的数组的一个旋转,输出旋转数组的最小元素。

Fibonacci:大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0)。n<=39

JumpFloor:一只青蛙一次可以跳上1级台阶,也可以跳上2级。求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果)。

JumpFloorII:一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。

RectCover:我们可以用21的小矩形横着或者竖着去覆盖更大的矩形。请问用n个21的小矩形无重叠地覆盖一个2*n的大矩形,总共有多少种方法?

NumberOf1:输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。

Power:给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。

ReOrderArray:输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有的奇数位于数组的前半部分,所有的偶数位于数组的后半部分,并保证奇数和奇数,偶数和偶数之间的相对位置不变。

FindKthToTail:输入一个链表,输出该链表中倒数第k个结点。

ReverseList:输入一个链表,反转链表后,输出新链表的表头。

MergeList:输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。

TreeMirror:树的镜像

HasSubTree:判断子树

PrintMatrix:顺时针打印矩阵

StackMin:定义栈结构,找最小值

NumArrayDuplicate:寻找数组中的重复数字

TreeDepth:树的深度

IsSymmetrical:是否是对称二叉树

Leetcode

MinTreeDepth:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

EvalRPN:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.

MaxPoints:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.

SortList:Sort a linked list in O(n log n) time using constant space complexity.

InsertionSortList:Sort a linked list in O(n log n) time using constant space complexity.

PostorderTraversal:Sort a linked list in O(n log n) time using constant space complexity.

PreorderTraversal:Given a binary tree, return the preorder traversal of its nodes' values.

ReorderList:Given a singly linked list L: L 0→L 1→…→L n-1→L n,reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→…

TwoSum:Given an array of integers, find two numbers such that they add up to a specific target number.

DetectCycle:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.

HasCycle:Given a linked list, determine if it has a cycle in it.

real:校招真题

Wangyi01:独立的小易

Wangyi02:等差数列

Wangyi03:01交错字符串

Wangyi04:操作序列

Aiqiyi01:判断题

Aiqiyi02:排序

Aiqiyi03:判断重复字符

Aiqiyi04:字符串价值

Aiqiyi05:循环数比较

Tencent:数字转换机

Beike01:斐波那契数列

Pinduoduo01:最大乘积

Pinduoduo02:大整数相乘

Pinduoduo03:六一儿童节

Huanjushidai01:判断重复字符串最大长度

Tuniu01:判断两个字符串的最大相同长度

Kugou01:买橙子

Xunlei01:2的N次方

Xunlei02:整数求和

Xunlei03:整数反转

Xunlei04:区间合并

Juan01:字符之间的距离

Juan02:最长回文字符串

Juan03:统计重复出现最多字符

Yilong01:买面包

Meituan01:超链接