From b55b84105f20e590277a6118b506795e418887f7 Mon Sep 17 00:00:00 2001 From: Piyush6869 <137883301+Piyush6869@users.noreply.github.com> Date: Wed, 11 Oct 2023 00:18:11 +0530 Subject: [PATCH] Update Count of Smaller Numbers After Self --- .../Count of Smaller Numbers After Self | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/LeetcodeProblems/Algorithms/Count of Smaller Numbers After Self b/LeetcodeProblems/Algorithms/Count of Smaller Numbers After Self index e3a09d1..9563277 100644 --- a/LeetcodeProblems/Algorithms/Count of Smaller Numbers After Self +++ b/LeetcodeProblems/Algorithms/Count of Smaller Numbers After Self @@ -18,12 +18,16 @@ Output: [0,0] -def countSmaller(nums): - result = [] - for i in range(len(nums)): - count = 0 - for j in range(i + 1, len(nums)): - if nums[j] < nums[i]: - count += 1 - result.append(count) - return result +function countSmaller(nums) { + const result = []; + for (let i = 0; i < nums.length; i++) { + let count = 0; + for (let j = i + 1; j < nums.length; j++) { + if (nums[j] < nums[i]) { + count += 1; + } + } + result.push(count); + } + return result; +}
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: