1 鍒楀嚭emp琛ㄤ腑鍚勯儴闂ㄧ殑閮ㄩ棬鍙鳳紝鏈楂樺伐璧勶紝鏈浣庡伐璧?BR>select max(sal) as 鏈楂樺伐璧?min(sal) as 鏈浣庡伐璧?deptno from emp group by deptno;
2 鍒楀嚭emp琛ㄤ腑鍚勯儴闂╦ob涓?CLERK'鐨勫憳宸ョ殑鏈浣庡伐璧勶紝鏈楂樺伐璧?BR>select max(sal) as 鏈楂樺伐璧?min(sal) as 鏈浣庡伐璧?deptno as 閮ㄩ棬鍙?from emp where job = 'CLERK' group by deptno;
3 瀵逛簬emp涓渶浣庡伐璧勫皬浜?000鐨勯儴闂紝鍒楀嚭job涓?CLERK'鐨勫憳宸ョ殑閮ㄩ棬鍙鳳紝鏈浣庡伐璧勶紝鏈楂樺伐璧?BR>select max(sal) as 鏈楂樺伐璧?min(sal) as 鏈浣庡伐璧?deptno as 閮ㄩ棬鍙?from emp as b where job='CLERK' and 1000>(select min(sal) from emp as a where a.deptno=b.deptno) group by b.deptno
4 鏍規嵁閮ㄩ棬鍙風敱楂樿屼綆錛屽伐璧勬湁浣庤岄珮鍒楀嚭姣忎釜鍛樺伐鐨勫鍚嶏紝閮ㄩ棬鍙鳳紝宸ヨ祫 select deptno as 閮ㄩ棬鍙?ename as 濮撳悕,sal as 宸ヨ祫 from emp order by deptno desc,sal asc
5 鍐欏嚭瀵逛笂棰樼殑鍙︿竴瑙e喅鏂規硶 錛堣琛ュ厖錛?/P>
6 鍒楀嚭'寮犱笁'鎵鍦ㄩ儴闂ㄤ腑姣忎釜鍛樺伐鐨勫鍚嶄笌閮ㄩ棬鍙?BR>select ename,deptno from emp where deptno = (select deptno from emp where ename = '寮犱笁')
7 鍒楀嚭姣忎釜鍛樺伐鐨勫鍚嶏紝宸ヤ綔錛岄儴闂ㄥ彿錛岄儴闂ㄥ悕 select ename,job,emp.deptno,dept.dname from emp,dept where emp.deptno=dept.deptno
8 鍒楀嚭emp涓伐浣滀負'CLERK'鐨勫憳宸ョ殑濮撳悕錛屽伐浣滐紝閮ㄩ棬鍙鳳紝閮ㄩ棬鍚?BR>select ename,job,dept.deptno,dname from emp,dept where dept.deptno=emp.deptno and job='CLERK'
9 瀵逛簬emp涓湁綆$悊鑰呯殑鍛樺伐錛屽垪鍑哄鍚嶏紝綆$悊鑰呭鍚嶏紙綆$悊鑰呭閿負mgr錛?BR>select a.ename as 濮撳悕,b.ename as 綆$悊鑰?from emp as a,emp as b where a.mgr is not null and a.mgr=b.empno
10 瀵逛簬dept琛ㄤ腑錛屽垪鍑烘墍鏈夐儴闂ㄥ悕錛岄儴闂ㄥ彿錛屽悓鏃跺垪鍑哄悇閮ㄩ棬宸ヤ綔涓?CLERK'鐨勫憳宸ュ悕涓庡伐浣?BR>select dname as 閮ㄩ棬鍚?dept.deptno as 閮ㄩ棬鍙?ename as 鍛樺伐鍚?job as 宸ヤ綔 from dept,emp where dept.deptno *= emp.deptno and job = 'CLERK'
11 瀵逛簬宸ヨ祫楂樹簬鏈儴闂ㄥ鉤鍧囨按騫崇殑鍛樺伐錛屽垪鍑洪儴闂ㄥ彿錛屽鍚嶏紝宸ヨ祫錛屾寜閮ㄩ棬鍙鋒帓搴?BR>select a.deptno as 閮ㄩ棬鍙?a.ename as 濮撳悕,a.sal as 宸ヨ祫 from emp as a where a.sal>(select avg(sal) from emp as b where a.deptno=b.deptno) order by a.deptno
12 瀵逛簬emp錛屽垪鍑哄悇涓儴闂ㄤ腑騫沖潎宸ヨ祫楂樹簬鏈儴闂ㄥ鉤鍧囨按騫崇殑鍛樺伐鏁板拰閮ㄩ棬鍙鳳紝鎸夐儴闂ㄥ彿鎺掑簭 select count(a.sal) as 鍛樺伐鏁?a.deptno as 閮ㄩ棬鍙?from emp as a where a.sal>(select avg(sal) from emp as b where a.deptno=b.deptno) group by a.deptno order by a.deptno
13 瀵逛簬emp涓伐璧勯珮浜庢湰閮ㄩ棬騫沖潎姘村鉤錛屼漢鏁板涓?浜虹殑錛屽垪鍑洪儴闂ㄥ彿錛屼漢鏁幫紝鎸夐儴闂ㄥ彿鎺掑簭 select count(a.empno) as 鍛樺伐鏁?a.deptno as 閮ㄩ棬鍙?avg(sal) as 騫沖潎宸ヨ祫 from emp as a where (select count(c.empno) from emp as c where c.deptno=a.deptno and c.sal>(select avg(sal) from emp as b where c.deptno=b.deptno))>1 group by a.deptno order by a.deptno
14 瀵逛簬emp涓綆浜庤嚜宸卞伐璧勮嚦灝?浜虹殑鍛樺伐錛屽垪鍑哄叾閮ㄩ棬鍙鳳紝濮撳悕錛屽伐璧勶紝浠ュ強宸ヨ祫灝戜簬鑷繁鐨勪漢鏁?BR>select a.deptno,a.ename,a.sal,(select count(b.ename) from emp as b where b.sal<a.sal) as 浜烘暟 from emp as a where (select count(b.ename) from emp as b where b.sal<a.sal)>5
]]>鍦ㄩ儴緗睵ORTAL欏圭洰鏃訛紝閬囧埌寮傚父錛孯epoExceptionTextFormatter ClassNotFound http://www.tkk7.com/freddychu/archive/2006/02/15/30886.html椋庤惂钀?/dc:creator>椋庤惂钀?/author>Wed, 15 Feb 2006 15:14:00 GMThttp://www.tkk7.com/freddychu/archive/2006/02/15/30886.htmlhttp://www.tkk7.com/freddychu/comments/30886.htmlhttp://www.tkk7.com/freddychu/archive/2006/02/15/30886.html#Feedback0http://www.tkk7.com/freddychu/comments/commentRss/30886.htmlhttp://www.tkk7.com/freddychu/services/trackbacks/30886.htmlException:weblogic.management.ApplicationException: prepare failed for content_repo.jar Module: content_repo.jar Error: Exception preparing module: EJBModule(content_repo.jar,status=NEW) Unable to deploy EJB: content_repo.jar from content_repo.jar: Class not found: com.bea.content.repo.i18n.RepoExceptionTextFormatter java.lang.NoClassDefFoundError: Class not found: com.bea.content.repo.i18n.RepoExceptionTextFormatter at weblogic.ejb20.compliance.EJBComplianceChecker.check([Ljava.lang.Object;)V(EJBComplianceChecker.java:287)
]]>GOOGLE鎸戞垬璧涚粌涔犻3鍙婄瓟妗?/title>http://www.tkk7.com/freddychu/archive/2005/11/27/21591.html椋庤惂钀?/dc:creator>椋庤惂钀?/author>Sun, 27 Nov 2005 15:42:00 GMThttp://www.tkk7.com/freddychu/archive/2005/11/27/21591.htmlhttp://www.tkk7.com/freddychu/comments/21591.htmlhttp://www.tkk7.com/freddychu/archive/2005/11/27/21591.html#Feedback2http://www.tkk7.com/freddychu/comments/commentRss/21591.htmlhttp://www.tkk7.com/freddychu/services/trackbacks/21591.html
Problem Statement
When editing a single line of text, there are four keys that can be used to move the cursor: end, home, left-arrow and right-arrow. As you would expect, left-arrow and right-arrow move the cursor one character left or one character right, unless the cursor is at the beginning of the line or the end of the line, respectively, in which case the keystrokes do nothing (the cursor does not wrap to the previous or next line). The home key moves the cursor to the beginning of the line, and the end key moves the cursor to the end of the line.
You will be given a int, N, representing the number of character in a line of text. The cursor is always between two adjacent characters, at the beginning of the line, or at the end of the line. It starts before the first character, at position 0. The position after the last character on the line is position N. You should simulate a series of keystrokes and return the final position of the cursor. You will be given a String where characters of the String represent the keystrokes made, in order. 'L' and 'R' represent left and right, while 'H' and 'E' represent home and end.
Definition
Class:
CursorPosition
Method:
getPosition
Parameters:
String, int
Returns:
int
Method signature:
int getPosition(String keystrokes, int N)
(be sure your method is public)
Constraints
-
keystrokes will be contain between 1 and 50 'L', 'R', 'H', and 'E' characters, inclusive.
-
N will be between 1 and 100, inclusive.
Examples
0)
"ERLLL"
10
Returns: 7
First, we go to the end of the line at position 10. Then, the right-arrow does nothing because we are already at the end of the line. Finally, three left-arrows brings us to position 7.
1)
"EHHEEHLLLLRRRRRR"
2
Returns: 2
All the right-arrows at the end ensure that we end up at the end of the line.
2)
"ELLLELLRRRRLRLRLLLRLLLRLLLLRLLRRRL"
10
Returns: 3
3)
"RRLEERLLLLRLLRLRRRLRLRLRLRLLLLL"
19
Returns: 12
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.
]]>GOOGLE鎸戞垬璧涚粌涔犻2鍙婄瓟妗?/title>http://www.tkk7.com/freddychu/archive/2005/11/27/21589.html椋庤惂钀?/dc:creator>椋庤惂钀?/author>Sun, 27 Nov 2005 15:40:00 GMThttp://www.tkk7.com/freddychu/archive/2005/11/27/21589.htmlhttp://www.tkk7.com/freddychu/comments/21589.htmlhttp://www.tkk7.com/freddychu/archive/2005/11/27/21589.html#Feedback0http://www.tkk7.com/freddychu/comments/commentRss/21589.htmlhttp://www.tkk7.com/freddychu/services/trackbacks/21589.html
Problem Statement
A square matrix is a grid of NxN numbers. For example, the following is a 3x3 matrix:
4 3 5
2 4 5
0 1 9
One way to represent a matrix of numbers, each of which is between 0 and 9 inclusive, is as a row-major String. To generate the String, simply concatenate all of the elements from the first row followed by the second row and so on, without any spaces. For example, the above matrix would be represented as "435245019".
You will be given a square matrix as a row-major String. Your task is to convert it into a String[], where each element represents one row of the original matrix. Element i of the String[] represents row i of the matrix. You should not include any spaces in your return. Hence, for the above String, you would return {"435","245","019"}. If the input does not represent a square matrix because the number of characters is not a perfect square, return an empty String[], {}.
Definition
Class:
MatrixTool
Method:
convert
Parameters:
String
Returns:
String[]
Method signature:
String[] convert(String s)
(be sure your method is public)
Constraints
-
s will contain between 1 and 50 digits, inclusive.
Examples
0)
"435245019"
Returns: {"435", "245", "019" }
The example above.
1)
"9"
Returns: {"9" }
2)
"0123456789"
Returns: { }
This input has 10 digits, and 10 is not a perfect square.
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.
1. Solve this cryptic equation, realizing of course that values for M and E could be interchanged. No leading zeros are allowed.
WWWDOT - GOOGLE = DOTCOM
2. Write a haiku describing possible methods for predicting search traffic seasonality.
3. 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1
What is the next line?
4. You are in a maze of twisty little passages, all alike. There is a dusty laptop here with a weak wireless connection. There are dull, lifeless gnomes strolling about. What dost thou do?
A) Wander aimlessly, bumping into obstacles until you are eaten by a grue. B) Use the laptop as a digging device to tunnel to the next level. C) Play MPoRPG until the battery dies along with your hopes. D) Use the computer to map the nodes of the maze and discover an exit path. E) Email your resume to Google, tell the lead gnome you quit and find yourself in whole different world.
5. What's broken with Unix? How would you fix it?
6. On your first day at Google, you discover that your cubicle mate wrote the textbook you used as a primary resource in your first year of graduate school. Do you:
A) Fawn obsequiously and ask if you can have an autograph. B) Sit perfectly still and use only soft keystrokes to avoid disturbing her concentration. C) Leave her daily offerings of granola and English toffee from the food bins.
D) Quote your favorite formula from the textbook and explain how it's now your mantra. E) Show her how example 17b could have been solved with 34 fewer lines of code. 7. Which of the following expresses Google鈻? over-arching philosophy?
A) "I'm feeling lucky" B) "Don't be evil" C) "Oh, I already fixed that" D) "You should never be more than 50 feet from food" E) All of the above
8. How many different ways can you color an icosahedron with one of three colors on each face?
What colors would you choose?
9. This space left intentionally blank. Please fill it with something that improves upon emptiness.
10.On an infinite, two-dimensional, rectangular lattice of 1-ohm resistors, what is the resistance between two nodes that are a knight's move away?
11.It's 2 PM on a sunny Sunday afternoon in the Bay Area. You're minutes from the Pacific Ocean, redwood forest hiking trails and world class cultural attractions. What do you do?
12.In your opinion, what is the most beautiful math equation ever derived?
13. Which of the following is NOT an actual interest group formed by Google employees?
A. Women's basketball B. Buffy fans C. Cricketeers D. Nobel winners E. Wine club
14.What will be the next great improvement in search technology?
15.What is the optimal size of a project team, above which additional members do not contribute productivity equivalent to the percentage increase in the staff size? A) 1 B) 3 C) 5 D) 11 E) 24
16.Given a triangle ABC, how would you use only a compass and straight edge to find a point P such that triangles ABP, ACP and BCP have equal perimeters? (Assume that ABC is constructed so that a solution does exist.)
17.Consider a function which, for a given whole number n, returns the number of ones required when writing out all numbers between 0 and n. For example, f(13)=6. Notice that f(1)=1. What is the next largest n such that f(n)=n?
18.What's the coolest hack you've ever written?
19.'Tis known in refined company, that choosing K things out of N can be done in ways as many as choosing N minus K from N: I pick K, you the remaining.
Find though a cooler bijection, where you show a knack uncanny, of making your choices contain all K of mine. Oh, for pedantry: let K be no more than half N.
20.What number comes next in the sequence: 10, 9, 60, 90, 70, 66,?
A)96 B) 1000000000000000000000000000000000 0000000000000000000000000000000000 000000000000000000000000000000000 C) Either of the above D) None of the above
21.In 29 words or fewer, describe what you would strive to accomplish if you worked at Google Labs.
]]>緇堜簬鎼炲畾Acegihttp://www.tkk7.com/freddychu/archive/2005/10/24/16511.html椋庤惂钀?/dc:creator>椋庤惂钀?/author>Sun, 23 Oct 2005 16:23:00 GMThttp://www.tkk7.com/freddychu/archive/2005/10/24/16511.htmlhttp://www.tkk7.com/freddychu/comments/16511.htmlhttp://www.tkk7.com/freddychu/archive/2005/10/24/16511.html#Feedback2http://www.tkk7.com/freddychu/comments/commentRss/16511.htmlhttp://www.tkk7.com/freddychu/services/trackbacks/16511.html浠婂ぉ鑺變簡涓涓嬪崍鍔犱竴鏅氫笂錛岀粓浜庡仛浜嗕竴涓熀浜嶢cegi鐨勮嚜宸辯殑HelloWorld銆?BR>鎰熻鍦≧DBMS鐨勮璇佹柟寮忕殑鎵╁睍涓婃湁浜涗笉鐏墊椿銆傞粯璁ゆ槸鍩轟簬寮婧愮殑鏁版嵁搴揌SQLDB鐨勶紝瀹炵幇榪欎釜鏈哄埗鐨勬槸JdbcDaoImpl.java綾匯傜湅浜唖ourcecode錛屽彂鐜扮被閲岄潰鍐欐浜嗕袱涓猄QL璇彞錛?BR> public static final String DEF_USERS_BY_USERNAME_QUERY = "SELECT username,password,enabled FROM users WHERE username = ?"; public static final String DEF_AUTHORITIES_BY_USERNAME_QUERY = "SELECT username,authority FROM authorities WHERE username = ?";