Lesson 15 of 34
Array Algorithms: Reverse, Search, Sort
10 min 30 XP
java.util.Arrays class-ൽ ഉപകാരപ്രദമായ helpers ഉണ്ട്: Arrays.toString() array ഭംഗിയായി print ചെയ്യുന്നു, Arrays.sort() അത് sort ചെയ്യുന്നു.
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.Interviews-ൽ പലപ്പോഴും library സഹായമില്ലാതെ ചെയ്യാൻ പറയും. Array തിരിക്കാൻ രണ്ട് അറ്റത്തുനിന്നും swap ചെയ്ത് നടുവിൽ കൂടിച്ചേരൂ (two-pointer technique).
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.രണ്ട് values swap ചെയ്യാൻ അതിലൊന്ന് സൂക്ഷിക്കുന്ന temp variable വേണം.