441 Arranging Coins | Zero to FAANG | Searching in Arrays | Leetcode
Vložit
- čas přidán 19. 09. 2021
- 441 Arranging Coins | Zero to FAANG | Searching in Arrays | Leetcode
Problem link :
leetcode.com/problems/arrangi...
Course link:
github.com/kunal-kushwaha/DSA...
Complete Java + DSA + Interview Preparation + CP Course
• Java + DSA + Interview...
Hi, thanks for watching our video about Arrays in Java
In this video we’ll walk you through:
- Brute Force
- Linear Search
- Binary Search
- Optimized Approach
TIMESTAMPS
Intro
Explanation begins
IDE solution
ABOUT OUR CHANNEL
Our channel is all about Programming. We cover lots of cool stuff such as solution to problems, concept explanation and tricks to master CP
Check out our channel here:
/ @programmerszone
Don’t forget to subscribe!
CHECK OUT OUR OTHER Playlists
GeeksforGeeks playlist:
• GeeksforGeeks problems
Complete C++ Course playlist:
• Complete C++ playlist
CodeChef Playlist:
• CodeChef Problems
HackerRank playlist:
• HackeRank problems
LeetCode problems
• Leetcode problems Solu...
FIND US AT
www.waadanibhao.wordpress.com
GET IN TOUCH
Contact us on hopesalivenow@gmail.com
441. Arranging Coins
Easy
1196
845
Add to List
Share
You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete.
Given the integer n, return the number of complete rows of the staircase you will build.
Example 1:
Input: n = 5
Output: 2
Explanation: Because the 3rd row is incomplete, we return 2.
Example 2:
Input: n = 8
Output: 3
Explanation: Because the 4th row is incomplete, we return 3.
Constraints:
1 = n = 231 - 1
Accepted
209,295
Submissions
484,859
#codechef #coding #python #hackerrank #programming #java #computerscience #coder #code #competitiveprogramming #machinelearning #pythonprogramming #algorithms #cpp #javascript #hackerearth #webdeveloper #geeksforgeeks #codinglife #leetcode #c #codeforces #engineering #codingmemes #programmer #hacker #programmingmemes #topcoder #webdevelopment #bhfyp #DSAwithKunal
Great explnation man!
Hey!
Thanks for the video, one correction in the brute force solution. The time complexity will be O(sqrt(n))
k as result, 1+2+...+k = N, then k(k+1) = 2N => k^2 = N => k = Sqrt(N)
Another correction in the last solution is the most optimal one. Here when we are using Math.sqrt(), it will make the time complexity log(n) -> not completely sure though, so our final time complexity wont be O(1) if we are using Math.sqrt
Thanks
Thanks for the info!
How can We build logic?? Like you I daily solve 2 questions watching video and after 2/3 days I'll try to solve that question with my self is it right approach??
Your problem solving skills are good.
Thanks for appreciating :)
Bro can u explain brute force why you doing n-=1 I didn't understand the purpose of this
bro how is brute force solution is O(n). i think it should be less than that
bro , how did you go to the brute force approach, can you share your thought process?..It will be helpful
Just write more and more examples and soon you'll get the intution to do that way.
bhai abhi aap college ke kon se year me ho ya fir aap job kar rahe ho
Currently Studying bro:)
Bhai lagtha h tumne just answers ko ratta mara h ,
Just code kesa work horaha h vo bolrahe ho,uska approach aur reason nhi bolrahe ho.
what is the name of the drawing software?
I use bandicam for recording and software is rovided by them only :)
@@ProgrammersZone i wanted to ask about the software where you were explaining the concept