Skip to main content

Command Palette

Search for a command to run...

Top 5 UKG Coding Interview Questions from 2025

Updated
4 min read

Introduction

In this blog post, we'll share the most commonly asked coding interview questions at UKG. If you don't have months to study for your interviews, you can use AI tools like Chatmagic to generate solutions quickly and efficiently - helping you pass the interviews and get the job offer!

Problem #1: Maximum Area Rectangle With Point Constraints I

You are given an array points where points[i] = [xi, yi] represents the coordinates of a point on an infinite plane. Your task is to find the maximum area of a rectangle that: Can be formed using four of these points as its corners. Does not contain any other point inside or on its border. Has its edges parallel to the axes. Return the maximum area that you can obtain or -1 if no such rectangle is possible. Example 1: Input: points = [[1,1],[1,3],[3,1],[3,3]] Output: 4 Explanation: We can make a rectangle with these 4 points as corners and there is no other point that lies inside or on the border. Hence, the maximum possible area would be 4. Example 2: Input: points = [[1,1],[1,3],[3,1],[3,3],[2,2]] Output: -1 Explanation: There is only one rectangle possible is with points [1,1], [1,3], [3,1] and [3,3] but [2,2] will always lie inside it. Hence, returning -1. Example 3: Input: points = [[1,1],[1,3],[3,1],[3,3],[1,2],[3,2]] Output: 2 Explanation: The maximum area rectangle is formed by the points [1,3], [1,2], [3,2], [3,3], which has an area of 2. Additionally, the points [1,1], [1,2], [3,1], [3,2] also form a valid rectangle with the same area. Constraints: 1 <= points.length <= 10 points[i].length == 2 0 <= xi, yi <= 100 All the given points are unique.

Topics: Array, Math, Binary Indexed Tree, Segment Tree, Geometry, Sorting, Enumeration

Problem #2: Maximum Area Rectangle With Point Constraints II

There are n points on an infinite plane. You are given two integer arrays xCoord and yCoord where (xCoord[i], yCoord[i]) represents the coordinates of the ith point. Your task is to find the maximum area of a rectangle that: Can be formed using four of these points as its corners. Does not contain any other point inside or on its border. Has its edges parallel to the axes. Return the maximum area that you can obtain or -1 if no such rectangle is possible. Example 1: Input: xCoord = [1,1,3,3], yCoord = [1,3,1,3] Output: 4 Explanation: We can make a rectangle with these 4 points as corners and there is no other point that lies inside or on the border. Hence, the maximum possible area would be 4. Example 2: Input: xCoord = [1,1,3,3,2], yCoord = [1,3,1,3,2] Output: -1 Explanation: There is only one rectangle possible is with points [1,1], [1,3], [3,1] and [3,3] but [2,2] will always lie inside it. Hence, returning -1. Example 3: Input: xCoord = [1,1,3,3,1,3], yCoord = [1,3,1,3,2,2] Output: 2 Explanation: The maximum area rectangle is formed by the points [1,3], [1,2], [3,2], [3,3], which has an area of 2. Additionally, the points [1,1], [1,2], [3,1], [3,2] also form a valid rectangle with the same area. Constraints: 1 <= xCoord.length == yCoord.length <= 2 105 0 <= xCoord[i], yCoord[i] <= 8 107 All the given points are unique.

Topics: Array, Math, Binary Indexed Tree, Segment Tree, Geometry, Sorting

Problem #4: Two Sum

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. Example 2: Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3: Input: nums = [3,3], target = 6 Output: [0,1] Constraints: 2 <= nums.length <= 104 -109 <= nums[i] <= 109 -109 <= target <= 109 Only one valid answer exists. Follow-up: Can you come up with an algorithm that is less than O(n2) time complexity?

Topics: Array, Hash Table

Problem #5: Valid Word

A word is considered valid if: It contains a minimum of 3 characters. It contains only digits (0-9), and English letters (uppercase and lowercase). It includes at least one vowel. It includes at least one consonant. You are given a string word. Return true if word is valid, otherwise, return false. Notes: 'a', 'e', 'i', 'o', 'u', and their uppercases are vowels. A consonant is an English letter that is not a vowel. Example 1: Input: word = "234Adas" Output: true Explanation: This word satisfies the conditions. Example 2: Input: word = "b3" Output: false Explanation: The length of this word is fewer than 3, and does not have a vowel. Example 3: Input: word = "a3$e" Output: false Explanation: This word contains a '$' character and does not have a consonant. Constraints: 1 <= word.length <= 20 word consists of English uppercase and lowercase letters, digits, '@', '#', and '$'.

Topics: String

More from this blog

C

Chatmagic blog

2894 posts