Desarrollador De Ui De Java Interview Questions

26,931 desarrollador de ui de java interview questions shared by candidates

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.
avatar

Senior Java Developer

Interviewed at Apple

4.1
Apr 18, 2025

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.

1. You will be given two end points with two API's a. response: [ { "product_uid": "6447344", "unit_price": 15.63, "unit_price_measure": "kg", "unit_price_measure_amount": 1 }, b. response from another API: [ { "product_uid": "6447344", "product_type": "BASIC", "name": "Sainsbury's Skin on ASC Scottish Salmon Fillets x2 240g", "full_url": "https://www.sainsburys.co.uk/gol-ui/product/sainsburys-responsibly-sourced-scottish-salmon-fillet-x2-240g" }, Task is: now you will have to get the response from these API's and map the response which is present in their requirement section. There is may be some calculations involved in it. 10 test cases pre generated, all must be passed. Important: you will need to write your own test cases ( which i failed due to lack of time because of terrible IDE from hackajob platform ) Overall the task was alright but writing in their IDE without auto formatting tools and behaviour of IDE is not similar to regular IDE's, I would say i would have done better if its in my local IDE. - Disappointed
avatar

Software Engineer - Java Developer

Interviewed at Sainsbury’s

3.6
Dec 22, 2024

1. You will be given two end points with two API's a. response: [ { "product_uid": "6447344", "unit_price": 15.63, "unit_price_measure": "kg", "unit_price_measure_amount": 1 }, b. response from another API: [ { "product_uid": "6447344", "product_type": "BASIC", "name": "Sainsbury's Skin on ASC Scottish Salmon Fillets x2 240g", "full_url": "https://www.sainsburys.co.uk/gol-ui/product/sainsburys-responsibly-sourced-scottish-salmon-fillet-x2-240g" }, Task is: now you will have to get the response from these API's and map the response which is present in their requirement section. There is may be some calculations involved in it. 10 test cases pre generated, all must be passed. Important: you will need to write your own test cases ( which i failed due to lack of time because of terrible IDE from hackajob platform ) Overall the task was alright but writing in their IDE without auto formatting tools and behaviour of IDE is not similar to regular IDE's, I would say i would have done better if its in my local IDE. - Disappointed

Viewing 2161 - 2170 interview questions

Glassdoor has 26,931 interview questions and reports from Desarrollador de ui de java interviews. Prepare for your interview. Get hired. Love your job.