• Skip to main content
  • Skip to footer

Ghoper logic

Algoritmos y lógica con Golang

  • Fácil
  • Intermedio
  • Avanzado
  • Todos
  • GitHub

Bit Manipulation

Hamming Weights of Integers

Easy

The Hamming weight of a number is the number of set bits (1-bits) in its binary representation. Given a positive integer n, return an array where the ith element is the Hamming weight of integer i for all integers from 0 to n.

Example:

Input: n = 7
Output: [0, 1, 1, 2, 1, 2, 2, 3]

Explanation:

NumberBinary representationNumber of set bits
000
111
2101
3112
41001
51012
61102
71113

Lonely Integer

Easy

Given an integer array where each number occurs twice except for one of them, find the unique number.

Example:

Input: nums = [1, 3, 3, 2, 1]
Output: 2

Constraints:

  • nums contains at least one element.

Swap Odd and Even Bits

Medium

Given an unsigned 32-bit integer n, return an integer where all of n‘s even bits are swapped with their adjacent odd bits.

Example 1:

Input: n = 41
Output: 22

Example 2:

Input: n = 23
Output: 43

Footer

Primeros con algoritmia

Algoritmo de Floyd

Algoritmos por dificultad en Go

  • Fácil
  • Intermedio
  • Avanzado
  • Todos
  • GitHub

Cada sábado estudio y juego con un algoritmo, y se me ocurrió compartir las notas notas para me obligarme a escribir mejor y así  empece a escribir en 2021.

Ahora puedes resolverlos con IA, pero lo hago por curiosidad!

Algoritmos fáciles con Go

  • Algoritmo de Floyd
  • In-Place
  • Amazon Interview | Asteroid Collision | Data Structures & Algorithms
  • Cifrado César
  • Básicas
  • Más usadas
  • Complejas

Algoritmos intemedios con Go

  • Algoritmo de Floyd
  • In-Place

Algoritmos avanzados con Go

  • Algoritmo de Floyd
  • In-Place

Copyright © 2026 · Log in