Skip to content

Commit

Permalink
wiggle-sort updated
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyanxing committed Feb 25, 2015
1 parent 7637603 commit 5af05c1
Show file tree
Hide file tree
Showing 5 changed files with 41,796 additions and 42,953 deletions.
2 changes: 1 addition & 1 deletion app/problems/wiggle-sort.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"ret_type_java": "void",
"out_type_java": "int[]",
"out_type_scala": "Array[Int]",
"out_type_scala": "List[Int]",
"judge_type_java": "!common.test_wiggle(wiggle_sort.in_0[i])",
"judge_type_ruby": "!test_wiggle(@in_0[i])",
"judge_type_python": "not test_wiggle(in_0[i])",
Expand Down
20 changes: 2 additions & 18 deletions judge/scala/Solution.scala
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
package judge; object Solution {
def wiggle_sort(arr: Array[Int]): Array[Int] = {
val n = arr.length;
if(n == 0) return Array();
var s = arr.clone();

var flag = true;
var current = s(0);
for (i <- 0 until n-1) {
if ((flag && current > s(i+1)) || (!flag && current < s(i+1))) {
s(i) = s(i+1);
} else {
s(i) = current;
current = s(i+1);
}
flag = !flag;
}
s(n-1) = current;
s;
def wiggle_sort(arr: List[Int]): List[Int] = {
List[Int](1,2,3);
}
}
6 changes: 3 additions & 3 deletions judge/scala/tests/wiggle_sort.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import judge.Solution

object wiggle_sort {
val num_test = 100;
var in_0 = Array[Array[Int]]();
var out = Array[Array[Int]]();
var in_0 = List[List[Int]]();
var out = List[List[Int]]();

def test_wiggle(arr: Array[Int], len: Int): Boolean = {
def test_wiggle(arr: List[Int], len: Int): Boolean = {
if(arr.length != len) return false;
else if(arr.length == 0) return true;

Expand Down
99 changes: 0 additions & 99 deletions judge/stdout.txt
Original file line number Diff line number Diff line change
@@ -1,100 +1 @@
Testing case #1
Testing case #2
Testing case #3
Testing case #4
Testing case #5
Testing case #6
Testing case #7
Testing case #8
Testing case #9
Testing case #10
Testing case #11
Testing case #12
Testing case #13
Testing case #14
Testing case #15
Testing case #16
Testing case #17
Testing case #18
Testing case #19
Testing case #20
Testing case #21
Testing case #22
Testing case #23
Testing case #24
Testing case #25
Testing case #26
Testing case #27
Testing case #28
Testing case #29
Testing case #30
Testing case #31
Testing case #32
Testing case #33
Testing case #34
Testing case #35
Testing case #36
Testing case #37
Testing case #38
Testing case #39
Testing case #40
Testing case #41
Testing case #42
Testing case #43
Testing case #44
Testing case #45
Testing case #46
Testing case #47
Testing case #48
Testing case #49
Testing case #50
Testing case #51
Testing case #52
Testing case #53
Testing case #54
Testing case #55
Testing case #56
Testing case #57
Testing case #58
Testing case #59
Testing case #60
Testing case #61
Testing case #62
Testing case #63
Testing case #64
Testing case #65
Testing case #66
Testing case #67
Testing case #68
Testing case #69
Testing case #70
Testing case #71
Testing case #72
Testing case #73
Testing case #74
Testing case #75
Testing case #76
Testing case #77
Testing case #78
Testing case #79
Testing case #80
Testing case #81
Testing case #82
Testing case #83
Testing case #84
Testing case #85
Testing case #86
Testing case #87
Testing case #88
Testing case #89
Testing case #90
Testing case #91
Testing case #92
Testing case #93
Testing case #94
Testing case #95
Testing case #96
Testing case #97
Testing case #98
Testing case #99
Testing case #100
Loading

0 comments on commit 5af05c1

Please sign in to comment.