This will be a solely style-focused review, because your code (don't take it personal) looks horrible...
##SPACE to breathe:
SPACE to breathe:
Your code is cramped, and your poor operators and statments a sqeezed together like sardines in a tin.
Spaces are free! Use them!
##Tabs to clarify:
Tabs to clarify:
You seem to have an aversion to indenting your code, or rather really indenting it. You indent by 2 spaces. That's a little thrifty. Use one tab or four spaces instead. This makes it easier to distinguish between levels, especially when you have large blocks of indented code in one method.
##Braces to see:
Braces to see:
Additionally you seem to dislike Braces to separate blocks. So here goes:
Wherever optional, still use braces!
Why? Because it's clear, consistent and less prone to bugs when you do.
##Ctrl+Shift+F to format:
Ctrl+Shift+F to format:
Use your IDE!!! Eclipse and Netbeans are both free, and both can do much of the formatting for you.
Your Code, after Applying just these three things:
public boolean groupSum6(int start, int[] nums, int target) {
if (nums.length == 0) {
return target == 0;
}
if (start == nums.length - 1) {
return target == nums[nums.length - 1] ||
(target == 0 && !(nums[nums.length - 1] == 6));
}
if (target == 0 && nums[start] == 6) {
return false;
}
if (target == 0 && !(nums[start] == 6)) {
return groupSum6(start + 1, nums, 0);
}
if (groupSum6(start + 1, nums, target - nums[start]) || nums[start] == 6) {
return groupSum6(start + 1, nums, target - nums[start]);
}
return groupSum6(start + 1, nums, target);
}
I think this is much more readable
This will be a solely style-focused review, because your code (don't take it personal) looks horrible...
##SPACE to breathe:
Your code is cramped, and your poor operators and statments a sqeezed together like sardines in a tin.
Spaces are free! Use them!
##Tabs to clarify:
You seem to have an aversion to indenting your code, or rather really indenting it. You indent by 2 spaces. That's a little thrifty. Use one tab or four spaces instead. This makes it easier to distinguish between levels, especially when you have large blocks of indented code in one method.
##Braces to see:
Additionally you seem to dislike Braces to separate blocks. So here goes:
Wherever optional, still use braces!
Why? Because it's clear, consistent and less prone to bugs when you do.
##Ctrl+Shift+F to format:
Use your IDE!!! Eclipse and Netbeans are both free, and both can do much of the formatting for you.
Your Code, after Applying just these three things:
public boolean groupSum6(int start, int[] nums, int target) {
if (nums.length == 0) {
return target == 0;
}
if (start == nums.length - 1) {
return target == nums[nums.length - 1] ||
(target == 0 && !(nums[nums.length - 1] == 6));
}
if (target == 0 && nums[start] == 6) {
return false;
}
if (target == 0 && !(nums[start] == 6)) {
return groupSum6(start + 1, nums, 0);
}
if (groupSum6(start + 1, nums, target - nums[start]) || nums[start] == 6) {
return groupSum6(start + 1, nums, target - nums[start]);
}
return groupSum6(start + 1, nums, target);
}
I think this is much more readable
This will be a solely style-focused review, because your code (don't take it personal) looks horrible...
SPACE to breathe:
Your code is cramped, and your poor operators and statments a sqeezed together like sardines in a tin.
Spaces are free! Use them!
Tabs to clarify:
You seem to have an aversion to indenting your code, or rather really indenting it. You indent by 2 spaces. That's a little thrifty. Use one tab or four spaces instead. This makes it easier to distinguish between levels, especially when you have large blocks of indented code in one method.
Braces to see:
Additionally you seem to dislike Braces to separate blocks. So here goes:
Wherever optional, still use braces!
Why? Because it's clear, consistent and less prone to bugs when you do.
Ctrl+Shift+F to format:
Use your IDE!!! Eclipse and Netbeans are both free, and both can do much of the formatting for you.
Your Code, after Applying just these three things:
public boolean groupSum6(int start, int[] nums, int target) {
if (nums.length == 0) {
return target == 0;
}
if (start == nums.length - 1) {
return target == nums[nums.length - 1] ||
(target == 0 && !(nums[nums.length - 1] == 6));
}
if (target == 0 && nums[start] == 6) {
return false;
}
if (target == 0 && !(nums[start] == 6)) {
return groupSum6(start + 1, nums, 0);
}
if (groupSum6(start + 1, nums, target - nums[start]) || nums[start] == 6) {
return groupSum6(start + 1, nums, target - nums[start]);
}
return groupSum6(start + 1, nums, target);
}
I think this is much more readable
This will be a solely style-focused review, because your code (don't take it personal) looks horrible...
##SPACE to breathe:
Your code is cramped, and your poor operators and statments a sqeezed together like sardines in a tin.
Spaces are free! Use them!
##Tabs to clarify:
You seem to have an aversion to indenting your code, or rather really indenting it. You indent by 2 spaces. That's a little thrifty. Use one tab or four spaces instead. This makes it easier to distinguish between levels, especially when you have large blocks of indented code in one method.
##Braces to see:
Additionally you seem to dislike Braces to separate blocks. So here goes:
Wherever optional, still use braces!
Why? Because it's clear, consistent and less prone to bugs when you do.
##Ctrl+Shift+F to format:
Use your IDE!!! Eclipse and Netbeans are both free, and both can do much of the formatting for you.
Your Code, after Applying just these three things:
public boolean groupSum6(int start, int[] nums, int target) {
if (nums.length == 0) {
return target == 0;
}
if (start == nums.length - 1) {
return target == nums[nums.length - 1] ||
(target == 0 && !(nums[nums.length - 1] == 6));
}
if (target == 0 && nums[start] == 6) {
return false;
}
if (target == 0 && !(nums[start] == 6)) {
return groupSum6(start + 1, nums, 0);
}
if (groupSum6(start + 1, nums, target - nums[start]) || nums[start] == 6) {
return groupSum6(start + 1, nums, target - nums[start]);
}
return groupSum6(start + 1, nums, target);
}
I think this is much more readable