-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1-8,10 #5
base: master
Are you sure you want to change the base?
1-8,10 #5
Conversation
return ""; | ||
|
||
|
||
return "<"+tag+">"+text+"</"+tag+">"; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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;} |
There was a problem hiding this comment.
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";} |
There was a problem hiding this comment.
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;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#floorMod-int-int-
You can use this for your purpose.
@@ -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]) { |
There was a problem hiding this comment.
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;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You can use increment.
- there is no need to check
arr[i]==0
because0%2 == 0
No description provided.