Skip to content

Conversation

@OlgaBerezhna
Copy link

No description provided.

Copy link
Member

@xSAVIKx xSAVIKx left a comment

Choose a reason for hiding this comment

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

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 + ">");
Copy link
Member

Choose a reason for hiding this comment

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

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);
Copy link
Member

Choose a reason for hiding this comment

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

s.substring(0,1) will return just 1 character.

StringBuffer newstring2 = new StringBuffer();
newstring2.append(s1).append(s2).append(s1);
return newstring2.toString();
}
Copy link
Member

Choose a reason for hiding this comment

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

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) {
Copy link
Member

Choose a reason for hiding this comment

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

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) {
Copy link
Member

Choose a reason for hiding this comment

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

The only possible values of any number % 2 are 0 and 1, so it'll be clearer if you'll check only those values.

@xSAVIKx
Copy link
Member

xSAVIKx commented Dec 11, 2016

@OlgaBerezhna your tasks do not pass all the tests, please rerun tests locally and check your implementation.

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