Conversation
xSAVIKx
left a comment
There was a problem hiding this comment.
Please solve Task9 and also fix your implementations, cause you've got failing tests.
| public static String makeTags(String tag, String text) { | ||
| return ""; | ||
|
|
||
| return String.format("%s", "<" + tag + ">" + text + "</" + tag + ">"); |
There was a problem hiding this comment.
You should use correct pattern, there is no need to concatenate whole string.
There are no restrictions for constant values in pattern, for example: <%s> will produce <argument_value>
| return s; | ||
| } | ||
| else { | ||
| return s.substring(0, 1); |
There was a problem hiding this comment.
s.substring(0,1) will return just 1 character.
| StringBuffer newstring2 = new StringBuffer(); | ||
| newstring2.append(s1).append(s2).append(s1); | ||
| return newstring2.toString(); | ||
| } |
There was a problem hiding this comment.
There is no need for StringBuffer in current task.
Also, StringBuffer use synchronized methods, so your code will be additionally slowed by synchronization.
| return 0; | ||
| int evenNum = 0; | ||
| for (int anArr : arr) { | ||
| if (anArr % 2 == 0) { |
There was a problem hiding this comment.
There is faster way to check whether number is even or odd. Read about parity bit.
|
|
||
| int n = 0; | ||
| for (int newArr: arr) { | ||
| if (newArr % 2 != 0) { |
There was a problem hiding this comment.
The only possible values of any number % 2 are 0 and 1, so it'll be clearer if you'll check only those values.
|
@OlgaBerezhna your tasks do not pass all the tests, please rerun tests locally and check your implementation. |
No description provided.