191 Number Of 1 Bits
Number of 1 Bits Write a function that takes the binary representation of a positive integer and returns the number of set bits it has (also known as the Hamming weight). Example 1: Input: n...
Number of 1 Bits Write a function that takes the binary representation of a positive integer and returns the number of set bits it has (also known as the Hamming weight). Example 1: Input: n...
Reverse Bits Reverse bits of a given 32 bits unsigned integer. Note: Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be gi...
String Compression Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating characters in chars: If t...
problemsolving Records problems solved in github pages WIP from operator import __mod__ import os import re import markdown2 import textile import shutil class MarkdownToHTML: def ...
Problem statement not found. import unittest import os import MarkdownToHTML class MarkdownToHTML(unittest.TestCase): def list_all_files(self): os.environ["input_ext"] = ".*"...
Reorder List You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln - 1 →...
Reorganize String Given a string s, rearrange the characters of s so that any two adjacent characters are not the same. Return any possible rearrangement of s or return “” if not possible. E...
Smallest Range I You are given an integer array nums and an integer k. In one operation, you can choose any index i where 0 <= i < nums.length and change nums[i] to nums[i] + x where x is ...
K Closest Points to Origin Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0). The distanc...
Task Scheduler You are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or interval allows the completion of one task. Tasks can be completed in ...