0%

Binary Watch – LeetCode 401

Problem

Description

A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).

Each LED represents a zero or one, with the least significant bit on the right.

Read more »

Nth Digit – LeetCode 400

Problem

Description

Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …

Read more »

Find the Difference – LeetCode 389

Problem

Description

Given two strings s and t which consist of only lowercase letters.

String t is generated by random shuffling string s and then add one more letter at a random position.

Find the letter that was added in t.

Read more »

First Unique Character in a String – LeetCode 387

Problem

Description

Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.

Read more »

Ransom Note – LeetCode 383

Problem

Description

Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; otherwise, it will return false.

Each letter in the magazine string can only be used once in your ransom note.

Read more »

Guess Number Higher or Lower – LeetCode 374

Problem

Description

We are playing the Guess Game. The game is as follows:

I pick a number from 1 to n. You have to guess which number I picked.

Every time you guess wrong, I’ll tell you whether the number is higher or lower.

You call a pre-defined API guess(int num) which returns 3 possible results (-1, 1, or 0):

Read more »

Sum of Two Integers – LeetCode 371

Problem

Description

Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.

Read more »

Valid Perfect Square – LeetCode 367

Problem

Description

Given a positive integer num, write a function which returns True if num is a perfect square else False.

Read more »

Logger Rate Limiter – LeetCode 359

Problem

Description

Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in the last 10 seconds.

Given a message and a timestamp (in seconds granularity), return true if the message should be printed in the given timestamp, otherwise returns false.

It is possible that several messages arrive roughly at the same time.

Read more »

Intersection of Two Arrays II – LeetCode 350

Problem

Description

Given two arrays, write a function to compute their intersection.

Read more »