Skip to content

Conversation

VynnykVV
Copy link

No description provided.

@didva didva self-assigned this Nov 24, 2016
return "";


return "<"+tag+">"+text+"</"+tag+">";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's Ok, but try to use String.format()

return "";

if(text==null){return null;}
String resultString = text.trim();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not an option. Task was do it without default trim.

@@ -3,6 +3,8 @@

public class Task2 {
public static String firstTwo(String s) {
return "";
if(s.length()<=2){return s;}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add null check too.

@@ -3,6 +3,11 @@

public class Task3 {
public static String comboString(String s1, String s2) {
return "";
}
if(s1==null){s1="null";}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format your code.

@@ -2,6 +2,11 @@

public class Task4 {
public static String charAt(String s, int i) {
return "";
int realCharAt=0;
if (i>=0&& s.length()>=i){realCharAt=i;}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -2,6 +2,10 @@

public class Task5 {
public static boolean commondEnd(int[] a, int[] b) {
if (a[0] == b[0]||a[a.length-1]==b[0]||a[0]==b[b.length-1]||a[a.length-1]==b[b.length-1]) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract to variables a[0] etc.

int count =0;
if(arr==null){return 0;}
for(int i=0; i<arr.length; i++){
if (arr[i]%2==0||arr[i]==0){count=count+1;}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You can use increment.
  2. there is no need to check arr[i]==0 because 0%2 == 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants