a*****p 发帖数: 1285 | 1 public class MouseComponent extends JComponent {
public MouseComponent() {
shapes = new ArrayList();
lines = new ArrayList();
bounds = new ArrayList();
current = null;
startpoint = null;
endpoint = null;
isSelected = false;
eraserSelected = false;
cursorPointer = false;
isLine = false;
clear = false;
filled = false;
shapeIndex =... 阅读全帖 |
|
W***i 发帖数: 9134 | 2 来自主题: JobHunting版 - 请教一道题 private int[][] A = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
public void printA()
{
int endX = A.length-1;
int endY = endX;
int startX = 0;
int startY = 0;
while(endX > 0 )
{
for(int i = startX; i <= endX; i++)
{
System.out.print(A[startX][i] + ",");
}
startY++;
for(int i = startY; i <= endY; i++)
{
System.out.print(A[i][endX] + ",");
}
endX--;
|
|
c******t 发帖数: 391 | 3 今天面试码工职位,被问到了一道coding题,说有一个m x n的二维矩阵Item[][],每一
个元素都是一个Item类的object, 其中Item类定义如下:
public class Item{
public int x; //
public int y;
}
x和y分别是矩阵里的另一个元素的横纵坐标。实现一个函数,给定一个起始点的横纵坐
标startX 和startY,返回从起始点出发的traversal是否能cover矩阵里的每一个点。
我的想法是用一个hashSet,每初始化一个Item,都放入这个set, 直到遇到重复元素
或null为止,然后计算hashSet的size是否等于matrix的size。我写的基本算法:
boolean getCoverage(Item[][] items, int startX, int startY){
Item item = items[startX][starty];
HashSet- set = new HashSet
- ();
set.add(item);
while(item... 阅读全帖 |
|
m*****k 发帖数: 731 | 4 public static int reach(char start, char end , int steps){
HashMap keyboard = new HashMap<>();
keyboard.put('1', new int[]{0,0});
keyboard.put('2', new int[]{0,1});
keyboard.put('3', new int[]{0,2});
keyboard.put('4', new int[]{1,0});
keyboard.put('5', new int[]{1,1});
keyboard.put('6', new int[]{1,2});
keyboard.put('7', new int[]{2,0});
keyboard.put('8', new int[]{2,1});
keyboard.put('9', new int[]{2,2});
keyboard.put('*', new int[]{3,0});
keyboard.put('0', new int[]{3,1});
... 阅读全帖 |
|
m*****k 发帖数: 731 | 5 那就再加个map存中间结果不就dp了么。
public static BigInteger reach(char start, char end, int steps) {
Map keyboard = new TreeMap<>();
Map pathsMap = new HashMap<>();
keyboard.put('1', new int[] { 0, 0 });
keyboard.put('2', new int[] { 0, 1 });
keyboard.put('3', new int[] { 0, 2 });
keyboard.put('4', new int[] { 1, 0 });
keyboard.put('5', new int[] { 1, 1 });
keyboard.put('6', new int[] { 1, 2 });
keybo... 阅读全帖 |
|
|
d*******o 发帖数: 68 | 7 他卖车的应该不会不知道吧,估计是忽悠我
startY
欢那 |
|
e***s 发帖数: 799 | 8 void filp(int startX, int startY, int endX, int endY){
}
这样一个方法? |
|
e***s 发帖数: 799 | 9 保证startX < endX; startY < end Y;
然后两层for循环不就完了吗?
是不是我miss something 了? |
|
t***o 发帖数: 293 | 10 Delta SkyMiles members who transfer points from American Express Membership
Rewards to Delta SkyMiles for the first time will receive 50 percent more mi
les through Sept. 30, 2011.
And to make the deal even more rewarding, if you transfer 100,000 or more Me
mbership Rewards points, you'll get 25,000 Medallion qualifying miles - that
's enough to get you to the first elite level, Silver, even if you're starti
ng from zero. Silver Medallion offers waived baggage fees, 25 percent bonus
Medallion qu... 阅读全帖 |
|
|
|
b********f 发帖数: 81 | 13 Time: Saturday morning 6am Leave from Jefferson county parking lot
Place: Jefferson County Court parking lot ( 6th Ave. & Johnson rd)
Weather at Mt. Sherman: 10% chance T-storem after 12pm.
Route: Southwest Ridge, this is a standard route.
Mt. Sherman - Southwest Ridge from Fourmile Creek
Difficulty: Class 2
Exposure: Mild exposure very close to the route.
Summit Elevation: 14,036 feet
Trailhead Elevation: 12,000 feet
Elevation Gain: 2,100' starting at the 12,000-foot gate
2,850' starti |
|
g****o 发帖数: 1284 | 14 我记得好几年前本版有个ID给Livingston取的绰号叫单立文,相当搞笑
Livingston's ceiling used to be so much higher. if he can shoot 3, he is
good for starti........ |
|
l******n 发帖数: 11737 | 15 【 以下文字转载自 Playstation3 俱乐部 】
发信人: lalaphin (orpheus), 信区: Playstation3
标 题: Motorstorm R/C - Free for a limited time for PS Vita(Starting 3/6)
发信站: BBS 未名空间站 (Mon Mar 5 11:26:24 2012, 美东)
Motorstorm R/C - Free for a limited time for PS Vita(Starting 3/6)
http://blog.us.playstation.com/2012/03/05/motorstorm-rc-driving
Will be available free for Vita owners tomorrow when the store updates which
is usually around 6PM EST
PS3 version is $9.99($7.49 for PS+) |
|
|
|
S*********u 发帖数: 980 | 18 nice!
但是现在发现当时贪便宜搞的4G的Card远远不够用了, 怎么办?
which |
|
g****n 发帖数: 7494 | 19 不知道可否先通过PS3用PSN账户购买
等有PSV以后,再下载下来
还是只能通过PSV购买并下载 |
|
p*****o 发帖数: 543 | 20 that's true for what i posted here....
but actually Im facing a more complicated situation. I have also other
variables, such as something like match_key. So once I need to keep track of
the original order....
Or probably I should change the way of posting the problem as we have
original data set:
Var1
A_1
A_2
B_1
B_2
B_3
C_1
C_2
C_3
...
and Im still trying to do the same thing as randomly pick 1 number from 1,2,
3 to assign to var1, while this can not be the same number for Var1 starti |
|
c*****k 发帖数: 2080 | 21 Thanks, this implies close to 2B market cap per today's price.
will buy some and see how it goes.
million
pla
been
ge
offerin
f
starti |
|