# 类别归档：LeetCode

LeetCode OJ is a platform for preparing technical coding interviews.

## 题目描述：

Given a binary search tree, write a function `kthSmallest` to find the kth smallest element in it.

Note:

You may assume k is always valid, 1 ≤ k ≤ BST's total elements.

What if the BST ...

## 题目描述：

Given an integer array of size n, find all elements that appear more than` ⌊ n/3 ⌋ `times. The algorithm should run in linear time and in O(1) space.

Hint:

How many majority elements could it possibly ...

## 题目描述：

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

Can you solve it without using extra space?

## 解题思路：

fast指针每次向前运动两个节点，slow指针每次向前运动一个节点

## Python代码（快慢指针）：

``# Definition for singly-linked list ...``

## 题目描述：

Given a sorted integer array without duplicates, return the summary of its ranges.

For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].

## 题目描述：

Implement a basic calculator to evaluate a simple expression string.

The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should truncate toward zero.

You may assume that the given expression is always valid.

Some ...