JavaRush /Java Blog /Random EN /Online tests for work.
Heavy
Level 30

Online tests for work.

Published in the Random EN group
Good afternoon. In general, I decided to create such a topic. Many companies use online testing when applying for a job. Moreover, the terms are in English. language and today I wrote such a test - https://www.hackerrank.com/ I recommend everyone to try it. Moreover, JavaRush does not welcome its tasks to the public, but there you can then show the rating to the employer. But oh well, not about that now. In general, I had 4 tests, for 90 minutes. It is not necessary to solve everything and it is written that it is better to solve several but qualitatively. And I would like to discuss them, because... I didn’t understand how they could have been solved better))))) Task 1. Write this - static int result(int[] arr){} An array is given in which to find the difference between the largest element and the smallest, and the index of the smallest must be less than the index of the largest one. I probably decided what everyone else thought - the first for searches for the largest element and index. Then the second for searches for the smallest element in the elements up to indexMax. And I just show the difference. And this solution is not the most optimal, it scored only 3 tests out of 10. What suggestions are there to solve it better? Now I’m thinking maybe it was possible to somehow put it into one for, but what if the sequence after the max element should not participate... or perhaps something like public static synchronized, etc. also give advantages in tests, did not check except public Task 2. write String[] result(String S, String T){} Two lines are given. (It was similar to javarush with files) Line T is line S without some words. Return an array of words that are missing in T. I solved it like this: split(t)=" " - the result in set; split(s)=" ", for and if !set.contains(s[i]) then add to ArrayList result; then return result.toArray(new String[0]); 5 tests out of 10; At first result was Set - there were 3 tests out of 10; Does anyone have any other comments or suggestions? Problem 3. I haven’t solved it, but if anyone is interested, given the text String[] and find all the domains in the text and display it on the screen. Like "lyalala http://www.xyz.ru lyall yall http://ww2.abc.com/sfsflj&dsf?dsfslj/index.html lyala" output "xyz.ru;abc.com" 4th With binary trees, I didn’t read it, it was a shame I had time
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION