Java Homework

2009-01-07 8:14 am
Here is the problem in Java:

1.)Given an int array length 3, if there is a 2 in the array immediately followed by a 3, set the 3 element to 0. Return the changed array.

fix23({1, 2, 3}) → {1, 2, 0}
fix23({2, 3, 5}) → {2, 0, 5}
fix23({1, 2, 1}) → {1, 2, 1}
public int[] fix23(int[] nums)

2.)Given an int array, return true if the array contains 2 twice, or 3 twice. The array will be length 0, 1, or 2.

double23({2, 2}) → true
double23({3, 3}) → true
double23({2, 3}) → false
public int[] fix23(int[] nums)

more information in www.javabat.com
in the cateogy of Array1 fix 23 and double 23

回答 (1)

2009-01-08 5:56 pm
✔ 最佳答案
I have already replied by PM.


2009-01-08 09:57:22 補充:
Feel free to let me know if you have other questions.


收錄日期: 2021-04-13 16:21:10
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090107000051KK00037

檢視 Wayback Machine 備份