leetcode & Mock Interview】的更多相关文章

leetcode & Mock Interview https://leetcode.com/interview/ xgqfrms 2012-2020 www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!…
March 16, 2016 Problem statement:Given a 2D array (matrix) named M, print all items of M in a spiral order, clockwise.For example: M  =  1   2   3   4   5       6   7   8   9  10      11  12  13  14  15      16  17  18  19  20 The clockwise spiral pr…
Pramp - mock interview experience   February 23, 2016 Read the article today from hackerRank blog on facebook: http://venturebeat.com/2016/02/18/how-i-landed-a-google-internship-in-6-months/?utm_content=buffer5c137&utm_medium=social&utm_source=fac…
LeetCode Top Interview Questions https://leetcode.com/problemset/top-interview-questions/ # No. Title Acceptance Difficulty 1 1 Two Sum 38.80% Easy 2 2 Add Two Numbers 29.10% Medium 3 3 Longest Substring Without Repeating Characters 25.00% Medium 4 4…
Given an array with integers. Find two non-overlapping subarrays A and B, which |SUM(A) - SUM(B)| is the largest. Return the largest difference. 1,-2,3,-1 1,3 A -1 B 7 public int maxDiffSubArrays(int[] nums) { // write your code here } Solution: publ…
1. shuffle算法: http://www.cnblogs.com/huaping-audio/archive/2008/09/09/1287985.html 注意:我们一般用的是第二种swap的方法:但是第一种直接选择,然后把最末尾一位填上的方法,也是很好的.只是会需要两倍的空间. 2. Random nextInt(bound)参数表示 0-inclusive,bound-exclusive: [0, bound) package com.company; import java.ut…
package com.company; import java.util.LinkedList; import java.util.List; public class Main { public int[] twoSum(int[] numbers, int target) { int i = 0, j = numbers.length - 1; int []ret = new int[2]; while (i < j) { if (numbers[i] + numbers[j] < ta…
shit LeetCode interview Question https://leetcode.com/interview/1/ 有点晕,啥意思,没太明白,到底是要按什么排序呀? 去掉 标识符 不去掉,TMD 也不对呀 难道... const uniqueKey = arr.slice(1).join(` `).replace(/[0-9]/g, ``); // const uniqueKey = arr.join(` `).replace(/[0-9]/g, ``); /** * @par…
@表示有更优解法 https://oj.leetcode.com/problems/integer-to-roman/ 将自然数,转换成罗马数字,输入范围为 1 ~ 3999,因为罗马数没有0. 用一个map,表示 1 ~ 9, 10 ~ 90, 100 ~ 900, 1000 ~ 3000,然后,把相应的罗马字母存起来. 之后,求出输入有几个 1000 ,几个 100 ,几个1来. #include <iostream> #include <map> #include <s…
Contest 111 (题号941-944)(2019年1月19日,补充题解,主要是943题) 链接:https://leetcode.com/contest/weekly-contest-111 [941]Valid Mountain Array(第一题 3分)(google tag) 判断一个数组是不是 Mountain 数组. Mountain 数组的定义是 A.length >= 3There exists some i with 0 < i < A.length - 1 su…