All Posts

Leetcode 2778: Sum of Squares of Special Elements

Given a 1-indexed integer array nums of length n, an element nums[i] is considered special if the index i divides the length n (i.e., n % i == 0). Your task is to find the sum of the squares of all special elements in the array.

Leetcode 2784: Check if Array is Good

Determine if an integer array nums is a permutation of a special array base[n], defined as [1, 2, …, n - 1, n, n], where 1 to n-1 appear once and n appears twice.

Leetcode 2788: Split Strings by Separator

You are given an array ‘words’ of strings and a character ‘separator’. Your task is to split each string in ‘words’ by the separator. After the split, return an array of strings containing the new substrings, excluding any empty strings.

Leetcode 2798: Number of Employees Who Met the Target

You are given an array ‘hours’ where each element represents the number of hours an employee has worked at the company. The company requires each employee to work for at least ’target’ hours. Your task is to return the number of employees who worked at least ’target’ hours.

Leetcode 2806: Account Balance After Rounded Purchase

You have a bank account with a balance of 100 dollars. You are given a purchase amount and need to round it to the nearest multiple of 10. Then, deduct the rounded amount from your account balance and return the remaining balance.

Leetcode 2810: Faulty Keyboard

You are given a string s. On your faulty keyboard, whenever you press ‘i’, the string typed so far is reversed. Pressing any other character types it normally. Simulate typing the entire string and return the final string displayed on the screen.