摘要: 中英题面 在未排序的数组中找到第 k 个最大的元素。请注意,你需要找的是数组排序后的第 k 个最大的元素,而不是第 k 个不同的元素。 Find the kth largest element in an unsorted array. Note that it is the kth largest 阅读全文
posted @ 2018-05-20 05:05 Efve 阅读(643) 评论(0) 推荐(0) 编辑
摘要: 中英题面 你是一个专业的小偷,计划偷窃沿街的房屋,每间房内都藏有一定的现金。这个地方所有的房屋都围成一圈,这意味着第一个房屋和最后一个房屋是紧挨着的。同时,相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。 After robbing those houses 阅读全文
posted @ 2018-05-20 05:01 Efve 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 中英题面 在 O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序。 Sort a linked list in O(n log n) time using constant space complexity. 示例 1: 输入: 4->2->1->3 输出: 1->2->3->4 阅读全文
posted @ 2018-05-20 04:56 Efve 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 中英题面 在一条环路上有 N 个加油站,其中第 i 个加油站有汽油 gas[i] 升。 There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. 你有一辆油箱容量无 阅读全文
posted @ 2018-05-20 04:52 Efve 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 中英题面 给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbe 阅读全文
posted @ 2018-05-20 04:41 Efve 阅读(489) 评论(0) 推荐(0) 编辑
摘要: 中英题面 给定一个非负整数数组,你最初位于数组的第一个位置。 Given an array of non-negative integers, you are initially positioned at the first index of the array. 数组中的每个元素代表你在该位置可 阅读全文
posted @ 2018-05-20 04:35 Efve 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 中英题面 合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 示例: 输入: [ 阅读全文
posted @ 2018-05-20 04:28 Efve 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 中英题面 给定两个大小为 m 和 n 的有序数组 nums1 和 nums2 。 There are two sorted arrays nums1 and nums2 of size m and n respectively. 请找出这两个有序数组的中位数。要求算法的时间复杂度为 O(log (m 阅读全文
posted @ 2018-05-20 04:22 Efve 阅读(1162) 评论(1) 推荐(0) 编辑