一、题目描述 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 题目解读:将数值表示成罗马数字的形式 思路:先要清楚罗马数字的表示规则
罗马数字共有七个:I(1&a…
一、题目描述 Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes. You should try to do it in place. The program should run in O(1) space c…
一、题目描述 Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not the kth distinct element. Example:
matrix […
一、题目描述 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 ≤ BSTs total elements. Follow up: What if the BST is modified (insert/delete operations) often an…