PHP

Daily Leetcode Solutions

  • leetcode
  • js

9 comments

Karleb Harkeju
3 days ago

image

Somtimes you gats cram answer. This answer dey very crammable.

#leetcode

Karleb Harkeju
5 days ago

image

I posted the wrong screenshot for the last message.

So i am posting the correct screenshot for correction.

Karleb Harkeju
5 days ago

image

I actually did yesterday's question yesterday but I was too tired to post here.

First, you create an array that represent each letter in english alphabet as digits. That is, an array of length 26 and give all a value of false.

Then for every char in allowed, mark their corresponding values as true based on their index. I mean, a will be index 0, b index 1, c index 2 etc.

So if allowed is 'ac', mark index 0 and c as true.

Then make a 2 level loop. The first loops through the array of words and the second loops through each char in each words.

Now check if the word is mark as false, if it is, increment a counter. The initial value of the counter is 0.

Lastly, return the difference between the length of words array and the counter.

That magically gives you the answer. ;D

#leetcode

Karleb Harkeju
1 week ago

image

Today's leetcode is an easy one and quite simple to be frank.

so you have 2 binary numbers, say 11011 and 10110. Loop through the two binaries and check if the last bits in the binaries are different, if they are, increment count. That's all.

Karleb Harkeju
1 week ago

image

continuation

Load More...