Category Archives: Combinatorial

Sum of Floored Pairs

Given an integer array nums, return the sum of floor(nums[i] / nums[j]) for all pairs of indices 0 <= i, j < nums.length in the array. The floor() function returns the integer part of the division. Examples: Input: nums = [2,5,9] Output: 10 Explanation: floor(2 / 5) = floor(2 / 9) = floor(5 / 9) = 0 floor(2… Read More »

Snake and Ladder Pattern Formation

Design the pattern as represented in the famous snake and ladders game. Your task is to print the pattern as represented in snake and ladders game for a given integer input N, where N denotes the number of rows and columns of the pattern array. Note: N given will be always even. Examples: Input: N=4 Output: 7 8… Read More »