04 2016 档案

摘要:17.14 Oh, no! You have just completed a lengthy document when you have an unfortunate Find/Replace mishap. You have accidentally removed all spaces, p 阅读全文
posted @ 2016-04-30 12:20 Grandyang 阅读(850) 评论(0) 推荐(0) 编辑
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message co 阅读全文
posted @ 2016-04-30 12:18 Grandyang 阅读(1162) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. ExampleGiven n = 12, retur 阅读全文
posted @ 2016-04-30 12:16 Grandyang 阅读(2122) 评论(0) 推荐(0) 编辑
摘要:There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f 阅读全文
posted @ 2016-04-30 12:14 Grandyang 阅读(796) 评论(0) 推荐(0) 编辑
摘要:There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certai 阅读全文
posted @ 2016-04-30 12:13 Grandyang 阅读(1050) 评论(0) 推荐(0) 编辑
摘要:There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo 阅读全文
posted @ 2016-04-30 12:10 Grandyang 阅读(1018) 评论(0) 推荐(0) 编辑
摘要:Write a program to check whether a given number is an ugly number`. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For ex 阅读全文
posted @ 2016-04-30 12:07 Grandyang 阅读(510) 评论(0) 推荐(0) 编辑
摘要:Java和C++中都有关于子字符串的操作,C++中是substr(),Java中是substring(),两者的用法上稍有些区别,首先针对只有一个参数的情况: s.substr(start) 和 s.substring(start) 均表示从start位置开始到结尾的子字符串 而对于有两个参数的情况 阅读全文
posted @ 2016-04-30 00:21 Grandyang 阅读(3184) 评论(1) 推荐(2) 编辑
摘要:After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This t 阅读全文
posted @ 2016-04-29 12:38 Grandyang 阅读(846) 评论(0) 推荐(0) 编辑
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文
posted @ 2016-04-29 12:24 Grandyang 阅读(783) 评论(0) 推荐(0) 编辑
摘要:The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each hou 阅读全文
posted @ 2016-04-29 11:22 Grandyang 阅读(983) 评论(0) 推荐(0) 编辑
摘要:17.13 Consider a simple node-like data structure called BiNode, which has pointers to two other nodes. The data structure BiNode could be used to repr 阅读全文
posted @ 2016-04-29 10:50 Grandyang 阅读(952) 评论(0) 推荐(0) 编辑
摘要:17.12 Design an algorithm to find all pairs of integers within an array which sum to a specified value. 这道题实际上跟LeetCode上的Two Sum很类似,但是不同的是,那道题限定了只有一组解 阅读全文
posted @ 2016-04-28 10:42 Grandyang 阅读(522) 评论(0) 推荐(0) 编辑
摘要:Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes 阅读全文
posted @ 2016-04-27 13:54 Grandyang 阅读(821) 评论(2) 推荐(0) 编辑
摘要:17.11 Implement a method rand7() given rand5(). That is, given a method that generates a random number between 0 and 4 (inclusive), write a method tha 阅读全文
posted @ 2016-04-27 12:24 Grandyang 阅读(1117) 评论(0) 推荐(0) 编辑
摘要:17.10 Since XML is very verbose, you are given a way of encoding it where each tag gets mapped to a pre-defined integer value. The language/grammar is 阅读全文
posted @ 2016-04-27 11:13 Grandyang 阅读(963) 评论(0) 推荐(0) 编辑
摘要:You know what, left pad is javascript package and referenced by React: Github link One day his author unpublished it, then a lot of javascript project 阅读全文
posted @ 2016-04-26 13:05 Grandyang 阅读(1401) 评论(0) 推荐(0) 编辑
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文
posted @ 2016-04-26 12:47 Grandyang 阅读(1026) 评论(0) 推荐(0) 编辑
摘要:For an array A, if i < j, and A [i] > A [j], called (A [i], A [j]) is a reverse pair.return total of reverse pairs in A. ExampleGiven A = [2, 4, 1, 3, 阅读全文
posted @ 2016-04-26 11:32 Grandyang 阅读(4086) 评论(0) 推荐(0) 编辑
摘要:17.9 Design a method to find the frequency of occurrences of any given word in a book. 这道题让我们找书中单词出现的频率,那么首先需要搞清楚的问题是,只需要统计一个单词,还是多个单词。如果是一个单词的话,那直接就遍 阅读全文
posted @ 2016-04-26 10:20 Grandyang 阅读(650) 评论(0) 推荐(0) 编辑
摘要:17.8 You are given an array of integers (both positive and negative). Find the contiguous sequence with the largest sum. Return the sum. LeetCode上的原题, 阅读全文
posted @ 2016-04-26 09:20 Grandyang 阅读(813) 评论(0) 推荐(0) 编辑
摘要:17.7 Given any integer, print an English phrase that describes the integer (e.g., "One Thousand, Two Hundred Thirty Four"). LeetCode上的原题,请参见我之前的博客Inte 阅读全文
posted @ 2016-04-25 09:35 Grandyang 阅读(687) 评论(0) 推荐(0) 编辑
摘要:Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Given s 阅读全文
posted @ 2016-04-24 12:07 Grandyang 阅读(10158) 评论(2) 推荐(0) 编辑
摘要:17.6 Given an array of integers, write a method to find indices m and n such that if you sorted elements m through n, the entire array would be sorted 阅读全文
posted @ 2016-04-23 15:52 Grandyang 阅读(697) 评论(0) 推荐(0) 编辑
摘要:Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, yo 阅读全文
posted @ 2016-04-22 12:38 Grandyang 阅读(13654) 评论(6) 推荐(0) 编辑
摘要:17.5 The Came of Master Mind is played as follows: The computer has four slots, and each slot will contain a ball that is red (R), yellow (Y), green ( 阅读全文
posted @ 2016-04-22 10:28 Grandyang 阅读(943) 评论(0) 推荐(0) 编辑
摘要:17.4 Write a method which finds the maximum of two numbers. You should not use if-else or any other comparison operator. 这道题让我们找出两个数中的较大值,不能用if..else. 阅读全文
posted @ 2016-04-21 10:33 Grandyang 阅读(487) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文
posted @ 2016-04-20 11:35 Grandyang 阅读(17937) 评论(16) 推荐(2) 编辑
摘要:LeetCode上的原题,讲解请参见我之前的博客Factorial Trailing Zeroes。 解法一: 解法二: CareerCup All in One 题目汇总 阅读全文
posted @ 2016-04-20 10:22 Grandyang 阅读(613) 评论(0) 推荐(0) 编辑
摘要:17.2 Design an algorithm to figure out if someone has won a game oftic-tac-toe. 这道题让我们判断玩家是否能赢井字棋游戏,有下面几点需要考虑: 1. 判断是否能赢hasWon函数是调用一次还是多次,如果是多次,我们可能为了 阅读全文
posted @ 2016-04-19 11:07 Grandyang 阅读(2650) 评论(0) 推荐(0) 编辑
摘要:【原创短片】(Theatrical Shorts)16部 《安德鲁和威利冒险记》《顽皮跳跳灯》《红色的梦》《锡铁小兵》《小雪人大行动》《棋逢敌手》《鸟!鸟!鸟!》《跳跳羊》《光杆乐队》《绑架课》《魔术师和兔子》《暴力云与送子鹳》《昼与夜》《月神》《蓝雨伞之恋》《岩浆》 【动画长片衍生篇】(Home 阅读全文
posted @ 2016-04-19 06:25 Grandyang 阅读(1671) 评论(0) 推荐(0) 编辑
摘要:In Maya 2015, we usually use mental ray to render our model, some new users may not see the mental ray item, that is because you have not loaded it ye 阅读全文
posted @ 2016-04-19 04:18 Grandyang 阅读(339) 评论(0) 推荐(0) 编辑
摘要:Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example 1: Example 2: Input: 5 Output: false Example 2: Follo 阅读全文
posted @ 2016-04-18 11:31 Grandyang 阅读(14732) 评论(5) 推荐(0) 编辑
摘要:我们在使用Maya软件的时候,有时候需要把语言在中英文之间切换,目前我感觉在不用插件的情况下,下面两种方法可以比较容易的做到: 方法一: 右键我的电脑属性,高级系统设置里面找到环境变量面板,然后新建一个环境变量,名字为 MAYA_UI_LANGUAGE,变量值设为en_US就是英文,设为zh_CN就 阅读全文
posted @ 2016-04-18 06:27 Grandyang 阅读(11351) 评论(0) 推荐(0) 编辑
摘要:17.1 Write a function to swap a number in place (that is, without temporary variables). 这道题让我们交换两个数,但是不能用额外空间,那么我们可以先做差值,存入a中,然后再加上b,存入b中,那么此时的b即为原来的a 阅读全文
posted @ 2016-04-18 00:39 Grandyang 阅读(809) 评论(0) 推荐(0) 编辑
摘要:16.6 You are given a class with synchronized method A and a normal method B. If you have two threads in one instance of a program, can they both execu 阅读全文
posted @ 2016-04-17 12:17 Grandyang 阅读(499) 评论(0) 推荐(0) 编辑
摘要:16.5 Suppose we have the following code:public class Foo { public Foo() { . . . } public void first() { ... } public void second() { ... } public void 阅读全文
posted @ 2016-04-17 11:41 Grandyang 阅读(615) 评论(0) 推荐(0) 编辑
摘要:Maya中mentalray灯光渲染终极训练视频教程 http://www.cgtsj.com/cg/f/vx3627/index.html Maya无人机建模制作训练视频教程第一季 http://www.cgtsj.com/cg/f/vx3626/index.html Maya动作捕捉关键帧技术视 阅读全文
posted @ 2016-04-17 06:02 Grandyang 阅读(6810) 评论(0) 推荐(1) 编辑
摘要:16.4 Design a class which provides a lock only if there are no possible deadlocks. 有很多方法可以避免死锁的发生,一个常用的方法是列出所需要的锁,然后判断锁上这些锁后会不会发生死锁,比如有如下的锁的顺序: A = {1 阅读全文
posted @ 2016-04-16 23:45 Grandyang 阅读(871) 评论(0) 推荐(0) 编辑
摘要:16.3 In the famous dining philosophers problem, a bunch of philosophers are sitting around a circular table with one chopstick between each of them. A 阅读全文
posted @ 2016-04-15 11:08 Grandyang 阅读(3895) 评论(0) 推荐(0) 编辑
摘要:16.2 How would you measure the time spent in a context switch? 上下文转换发生在两个进程之间,比如让一个等待进程进入执行和让一个运行进程进入等待,这些在多任务中发生。操作系统需要把等待进程的信息放入内存和把当前运行的进程信息保存下来。为了 阅读全文
posted @ 2016-04-14 09:41 Grandyang 阅读(727) 评论(0) 推荐(0) 编辑
摘要:Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may 阅读全文
posted @ 2016-04-13 23:43 Grandyang 阅读(5911) 评论(2) 推荐(0) 编辑
摘要:Write a bash script to calculate the frequency of each word in a text file words.txt. For simplicity sake, you may assume: words.txt contains only low 阅读全文
posted @ 2016-04-13 11:33 Grandyang 阅读(7033) 评论(1) 推荐(1) 编辑
摘要:16.1 What's the difference between a thread and a process? 进程Process是程序执行时的一个实例。一个进程是被分配系统资源的独立单元,每个进程在独立的地址空间上执行,如果需要使用其他进程的资源,需要使用进程间通讯,包括管道Pipes,文件 阅读全文
posted @ 2016-04-13 05:27 Grandyang 阅读(655) 评论(0) 推荐(0) 编辑
摘要:Given a text file file.txt, transpose its content. You may assume that each row has the same number of columns and each field is separated by the ' '  阅读全文
posted @ 2016-04-12 12:26 Grandyang 阅读(4267) 评论(0) 推荐(0) 编辑
摘要:15.7 Imagine a simple database storing information for students' grades. Design what this database might look like and provide a SQL query to return a 阅读全文
posted @ 2016-04-12 03:15 Grandyang 阅读(878) 评论(0) 推荐(0) 编辑
摘要:How would you print just the 10th line of a file? For example, assume that file.txt has the following content: Your script should output the tenth lin 阅读全文
posted @ 2016-04-11 06:12 Grandyang 阅读(5019) 评论(0) 推荐(0) 编辑
摘要:The Trips table holds all taxi trips. Each trip has a unique Id, while Client_Id and Driver_Id are both foreign keys to the Users_Id at the Users tabl 阅读全文
posted @ 2016-04-10 12:47 Grandyang 阅读(4914) 评论(6) 推荐(0) 编辑
摘要:Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates. For example, ret 阅读全文
posted @ 2016-04-09 13:08 Grandyang 阅读(5459) 评论(1) 推荐(0) 编辑
摘要:Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. For example, aft 阅读全文
posted @ 2016-04-09 11:35 Grandyang 阅读(6805) 评论(0) 推荐(0) 编辑
摘要:The Employee table holds all employees. Every employee has an Id, and there is also a column for the department Id. The Department table holds all dep 阅读全文
posted @ 2016-04-08 13:21 Grandyang 阅读(6327) 评论(1) 推荐(1) 编辑
摘要:The Employee table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id. The Department table hol 阅读全文
posted @ 2016-04-08 07:24 Grandyang 阅读(5125) 评论(1) 推荐(0) 编辑
摘要:15.6 Draw an entity-relationship diagram for a database with companies, people, and professionals (people who work for companies). 在公司Companies工作的人是专家 阅读全文
posted @ 2016-04-07 07:16 Grandyang 阅读(852) 评论(0) 推荐(0) 编辑
摘要:15.5 What is denormalization? Explain the pros and cons. 逆规范化Denormalization是一种通过添加冗余数据的数据库优化技术,可以帮助我们减少关系数据库中耗时的交Join。在一般的规范化的数据库中,我们将数据存在不同的表中是为了减少冗 阅读全文
posted @ 2016-04-07 06:57 Grandyang 阅读(1172) 评论(0) 推荐(0) 编辑
摘要:Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything 阅读全文
posted @ 2016-04-07 06:41 Grandyang 阅读(3095) 评论(1) 推荐(0) 编辑
摘要:Write a SQL query to find all duplicate emails in a table named Person. For example, your query should return the following for the above table: Note: 阅读全文
posted @ 2016-04-07 06:09 Grandyang 阅读(3841) 评论(0) 推荐(0) 编辑
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文
posted @ 2016-04-06 12:41 Grandyang 阅读(21333) 评论(3) 推荐(0) 编辑
摘要:15.4 What are the different types of joins? Please explain how they differ and why certain types are better in certain situations. Join是用来联合两个表的,每个表至少 阅读全文
posted @ 2016-04-05 12:13 Grandyang 阅读(717) 评论(0) 推荐(0) 编辑
摘要:The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Em 阅读全文
posted @ 2016-04-05 11:21 Grandyang 阅读(3858) 评论(0) 推荐(1) 编辑
摘要:Write a SQL query to find all numbers that appear at least three times consecutively. For example, given the above Logs table, 1 is the only number th 阅读全文
posted @ 2016-04-05 10:51 Grandyang 阅读(6336) 评论(0) 推荐(0) 编辑
摘要:Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking num 阅读全文
posted @ 2016-04-04 11:20 Grandyang 阅读(14132) 评论(17) 推荐(0) 编辑
摘要:Building #11 is undergoing a major renovation. Implement a query to close all requests from apartments in this building. -- TABLE Apartments -- TABLE 阅读全文
posted @ 2016-04-04 09:18 Grandyang 阅读(505) 评论(0) 推荐(0) 编辑
摘要:Write a SQL query to get a list of all buildings and the number of open requests (Requests in which status equals 'Open'). -- TABLE Apartments -- TABL 阅读全文
posted @ 2016-04-04 08:44 Grandyang 阅读(392) 评论(0) 推荐(0) 编辑
摘要:Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = "eceba", k = 2 Output: 3 阅读全文
posted @ 2016-04-04 08:22 Grandyang 阅读(26939) 评论(7) 推荐(2) 编辑
摘要:Write a SQL query to get a list of tenants who are renting more than one apartment. -- TABLE Apartments -- TABLE Buildings -- TABLE Tenants -- TABLE C 阅读全文
posted @ 2016-04-03 08:32 Grandyang 阅读(590) 评论(0) 推荐(0) 编辑
摘要:Write a SQL query to get the nth highest salary from the Employee table. For example, given the above Employee table, the nth highest salary where n = 阅读全文
posted @ 2016-04-03 05:43 Grandyang 阅读(10375) 评论(0) 推荐(1) 编辑
摘要:Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the second highest salary is  阅读全文
posted @ 2016-04-03 05:00 Grandyang 阅读(11308) 评论(7) 推荐(1) 编辑
摘要:Table: Person Table: Address Write a SQL query for a report that provides the following information for each person in the Person table, regardless if 阅读全文
posted @ 2016-04-03 04:09 Grandyang 阅读(6307) 评论(0) 推荐(1) 编辑
摘要:在SQL语言中,存在着各种Join,有Left Join, Right Join, Inner Join, and Natural Join等,对于初学者来说肯定一头雾水,都是神马跟神马啊,它们之间到底有着怎样的区别和联系呢,我们先用一张图片来说明: 上面这张图很好的阐释了Left Join, Ri 阅读全文
posted @ 2016-04-02 09:33 Grandyang 阅读(11284) 评论(1) 推荐(0) 编辑
摘要:More Information Check: http://blog.csdn.net/ithomer/article/details/5131863 阅读全文
posted @ 2016-04-01 03:24 Grandyang 阅读(3499) 评论(0) 推荐(0) 编辑

Fork me on GitHub