@greghogg5: BRUTE FORCE DEVELOPER vs Optimal Toronto Engineer on Single Number, Leetcode 136 #softwareengineering #softwaredevelopment #java #software #softwarejobs #softwareengineer #datastructures #leetcode #programming #javadeveloper #datastructuresandalgorithms #python #softwaredeveloper #code #FAANG #coding #javascript #javascriptdeveloper #codingisfun #codinginterview #js #html #css #sql

Greg Hogg
Greg Hogg
Open In TikTok:
Region: CA
Monday 03 June 2024 14:22:20 GMT
28483
1120
47
19

Music

Download

Comments

yossie224
Yossie :
You could do it O(n) without hashmal actually. Just run bitwise xor for every element. Without hashmap, it'll benefit memory consumption
2024-06-07 09:23:52
1
raffybija
Raffy :
None of this testing platform?
2024-06-15 08:22:56
0
adondesimpson0
adonde simpson :
💀💀💀
2024-06-27 04:27:13
0
ndimka
Dmitriy Nazaratiy :
Easier: n = len(nums) x = 0 for i in range(n): x = x ^ nums[i] return x Each duplicate will xor itself out, only non-duplicate will stay
2024-08-23 11:08:12
0
greghogg5
Greg Hogg :
Thank you for watching the video! Follow me to see these in your feed daily:)
2024-06-03 14:22:41
1
user5317850640417
bs :
The question states to use constant extra space but your hashmap uses O(n) space?
2024-06-03 14:32:25
63
efa_mini
￴ ￴￴￴￴ ￴￴￴￴￴￴￴Efa :
For constant space you can use bits, we will xor every number and we get the answer
2024-06-03 14:47:36
47
romhulio
罗曼 :
hashmap isn't constant spaced
2024-06-03 14:34:42
16
bokchoi36
user2538017214964 :
Linear space solution? Yuck: no thank you. Xor is what we need
2024-06-03 21:37:05
11
defaultuser42069
user895322 :
At this point… if my car breaks down my first thought will be to use a hashmap lol
2024-06-03 14:43:05
9
yajyajo
YajYaj :
This makes a lot of sense and I’ve discovered that a hashmap is the answer to everything
2024-06-03 14:29:17
7
g676912
G :
hashmap isn't constant space. therefore your answer is wrong and not optimal
2024-06-03 18:59:48
5
kbb1231w
kbb1231w :
That is not constant space
2024-06-03 15:58:47
1
rubyfireopal
RubyfireOpal :
Keep variable product = 1, go thru and if product is divisible by the current number, divide, otherwise multiply product by the final number, then the final value for product is ur answer 🦵
2024-06-03 15:03:46
1
shmida199113
Shmida199113 :
Xor ❤️
2024-08-21 21:26:38
0
sidanand47
Sid Anand :
Just loop through and do a running cumulative XOR. It takes constant space and o(n) runtime
2024-06-25 08:53:47
0
barkenflopsmcgee
Barkenflops Mcgee :
XOR is definitely the intended solution here, given the one odd number out.
2024-06-21 02:22:07
0
juanformoso81
Juan :
Where can I find this exercises to do them?
2024-06-12 22:49:50
0
sriragt
Srirag :
2 * sum(set(nums)) - sum(nums)
2024-06-09 03:07:56
0
raresanghel08
Rares :
what is the name of the site?
2024-06-05 21:07:46
0
ticklepapa
Tickle Papa Phila :
in JavaScript with xor: const singleNumber = (nums) => nums.reduce((acc,curr) => acc ^ curr, 0) linear time and no extra space used
2024-06-04 23:26:27
0
boofybath
pettertrippein :
xor
2024-06-04 06:58:44
0
sskartik_n
shawwww :
yeah I was like use a frequency hash map, but did not know python has a built in function for tht
2024-06-04 06:00:59
0
barbenezri
barbenezri :
xor
2024-06-03 19:34:39
0
giantdoob
giantdoob :
What would be linear? If not the hashmap?
2024-06-03 17:50:58
0
ayayanekoo
ayayanekoo :
what even is a hashmap
2024-06-03 15:17:06
0
To see more videos from user @greghogg5, please go to the Tikwm homepage.

Other Videos


About