自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 资源 (1)
  • 收藏
  • 关注

原创 Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between t...

2019-07-29 00:06:07 105

原创 Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s key.The rig...

2019-07-28 21:11:58 90

原创 二叉树非递归遍历方式

前序遍历:root,left,right用栈实现非递归遍历,访问root,将right先存栈,然后left再存栈vector<int> preorderTraversal(TreeNode* root) { stack<TreeNode*> s; vector<int> res; if (!root) retu...

2019-07-26 17:54:21 143

原创 3Sum

Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not contai...

2019-07-25 19:39:50 139

原创 Top K Frequent Elements

Given a non-empty array of integers, return the k most frequent elements.Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nums = [1], k = 1Output: [1]输出数组内最重复的k个数。emmm,...

2019-07-24 19:39:19 111

原创 Sliding Window Maximum

Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window m...

2019-07-20 19:34:23 100

原创 703. Kth Largest Element in a Stream

Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.Your KthLargest class will have a constructor whi...

2019-07-20 12:27:06 122

原创 Linked List Cycle II

Given a linked list, return the node where the cycle begins. If there is no cycle, return null.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-in...

2019-07-20 10:58:02 130

原创 Swap Nodes in Pairs

Given a linked list, swap every two adjacent nodes and return its head.You may not modify the values in the list’s nodes, only nodes itself may be changed.Example:Given 1->2->3->4, you sho...

2019-07-19 09:50:47 118

原创 Daily Temperatures

Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which...

2019-07-18 10:07:58 236

原创 Decode String

Given an encoded string, return its decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guara...

2019-07-17 21:17:00 148

原创 Longest Substring Without Repeating Characters

Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Input: ...

2019-07-17 09:50:25 86

原创 Island Perimeter

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water.Grid cells are connected horizontally/vertically (not diagonally). The grid is completely ...

2019-07-16 21:12:10 125

原创 旋转数组的最小数字

题目描述把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。 输入一个非减排序的数组的一个旋转,输出旋转数组的最小元素。 例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。 NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。这道题是剑指offer上的题目,坑多,且想到O(logn)时间复杂度的不容易。旋转数组基本有序,那可以考虑用...

2019-07-15 21:41:06 118

原创 Reverse Pairs

Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j].You need to return the number of important reverse pairs in the given array.Example1:Input: [1,3...

2019-07-12 11:11:37 156

原创 归并排序

归并排序C++实现归并排序用的是分治法,分治法往往用递归来实现。分治法的核心步骤分解问题当子问题能直接求解时,求解子问题合并子问题的解#include <iostream>#include <vector> #include <string>#include <algorithm>#include <cmath>...

2019-07-11 23:48:37 113

高校课堂质量评价体系

高校课堂质量评价体系,模糊评价,层次分析

2015-05-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除