MagicBricks Affordable Property Search
MagicBricks Affordable Property Search
EasyArrays100% accepted
Priya is searching for affordable apartments in Delhi on MagicBricks. She wants to find the sum of prices of K cheapest properties available in a locality. Given an array of property prices, help her calculate the total amount needed to view the K cheapest options.
Approach
Given an array of N property prices and integer K, find the sum of K smallest prices.
Input
prices=[50,30,20,40,25]
K=3
Output
75
More Arrays problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards