Another approach is to notice there are only a small amount of perfect squares in the bound. You can binary search that list and get a slightly more efficient run-time, though same time complexit
2024-06-01 15:47:45
30
yquefue :
Why not just loop from 1-x and check each square
2024-06-01 16:26:00
19
Luca :
that’s the built in exponent operator :(
2024-06-02 01:39:39
7
AAAAAGHSH :
If you know the maximum size of the integer you can just use a taylor series expansion to a certain precision
2024-06-01 19:32:57
3
Pablamon :
When I read this I immediately thought of Taylor series. It might be a hassle to code though, especially if you have to write x*x*x… whenever you want to exponentiate
2024-06-01 15:53:02
2
perronazz :
brute force for loop anyone 😆
2024-06-03 00:16:29
2
W Inston :
does any body else feel like this kind of leetcode stuff is going to end up like those guys who do MS excel obstacle courses as in who cares
2024-06-01 22:42:49
2
danyatheory :
What class do u learn this in
2024-06-01 12:53:12
1
. :
id do a version of the fast inverse sqrt from quake but instead of inverse sqrt calculate the sqrt regularly, still likely faster to do sqrt instruction on the cpu
2024-06-03 06:59:35
1
cyfr0n_ :
Waiting for 6502 mnemonics :)
2024-07-27 22:56:16
0
cyfr0n_ :
quick draft C++ like:
unsigned int sqrt(unsigned int x)
{
unsigned int s =0;
while (squareIntager(s)<=x)
{
s++;
}
return(s-1)
}
2024-07-27 22:53:12
0
Norman | 🌎 :
Gain time but sacrifices legibility
2024-07-29 23:16:43
0
Greg Hogg :
Thank you for watching the video! Follow me to see these in your feed daily, and be sure to check out the free goodies at the link in my bio :)
2024-06-01 12:31:42
0
zaie❤️ :
@Zazatech_support Made me noticed my ex was cheating
2024-08-27 10:43:11
0
Artur :
I‘ve seen the problem and most answers were just importing math and then using math.sqrt which is cheating lol
2024-06-13 13:35:28
0
wkorngod :
Just do a couple iterations of newtons method jfc
2024-06-06 05:31:21
0
Rares :
what is the name of the site?
2024-06-05 21:07:52
0
Mike Rey :
How about just exp(ln(x)/2) and then round?
2024-06-02 19:49:44
0
Pseudonym :
why not the quake III alogrithm times x ?????
2024-06-01 17:57:02
0
kev :
This was dope! I first thought no way could I figure it out but you did it so easily and clearly
2024-06-01 17:24:30
0
nick :
I LOVE BINARY SEARCH 🔥🔥🔥
2024-06-01 16:05:53
0
To see more videos from user @greghogg5, please go to the Tikwm
homepage.