You are given an array of words (strings) and an integer k k k. Your task is to write a function that returns the k k k longest words from the array. If there are fewer than k k k words in the array, return all the words sorted by length in descending order. If there are ties in length, return the words in alphabetical order. Input: An array of strings words[] where each string consists of lowercase and uppercase letters only. An integer k k k (1 ≤ k k k ≤ 100). Output: An array of the k k k longest words, sorted by length (and alphabetically if lengths are equal). Example: plaintextInput: words = ["apple", "banana", "kiwi", "grape", "watermelon"], k = 3 Output: ["watermelon", "banana", "apple"] Input: words = ["cat", "bat", "rat"], k = 5 Output: ["bat", "cat", "rat"] Constraints: The output array should not exceed k k k elements. You may assume that the input will always have at least one word.
Sr Developer Interview Questions
30,108 sr developer interview questions shared by candidates
Prepare for every topics that are needed.
Questions related Singleton class, how one can break it, how to improve upon its design
What is the design pattern of their open sourced Sync Engine?
4 tasks in Codility. The first one was about C++ basics like dynamic_cast etc, 4-choice Second one classic parsing exercise in C++ using string, maps, arrays, however very badly specified so that correct solution was simply not feasible in given time, unless you neglect most possible inputs and "go straight to dumbest implementation" that might or might not pass Codility scoring test. Third question is about dynamic programming, in-depth search of cheapest route. Fourth was numerical exercise, relative calculation on angles maybe easy but certainly might be tricky.
Write code to check the frequency of the element in the List.
Question on projects and experience. Question very specific to language syntax and libraries? (I don't know what is the use?) Question on LRU cache? Question on how to design ; 1) on designing a dashboard for live traffic and other on scalable storage.
How to render a button on screen? Don't use reference.
Q4. Based on my answer to the question above, he mentioned this code? - He said, that you are saying javascript is async. then what will be the output of this code console.log("a") Promise. execution() console.log("b") Will it wait to resolve promise or it will execute parallely ?
Complete Java question from basics to advance in detail flow
Viewing 2331 - 2340 interview questions