brightlightkim

  • 홈
  • 태그
  • 방명록

BitManipulation 2

LeetCode 67. Add Binary

Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = "11", b = "1" Output: "100" Example 2: Input: a = "1010", b = "1011" Output: "10101" Constraints: 1 =0){ if(i>=0){ sum = sum + a.charAt(i) - '0'; i--; } if(j>=0){ sum = sum + b.charAt(j) - '0'; j--; } sb.append(sum%2); sum = sum/2; } if(sum!=0) sb.append(sum); return sb.reverse().toString(); } }

Algorithms and Data Structures/Coding Practices 2022.06.14

Bit Manipulation

Bit Manipulation by Hand: ^ means XOR, ~ is a Not (Negation) - XOR: If it's a different bit, it will be 1. EX) 1101 ^ (~1101) = 1111 - If you XOR a bit with its own negated value, you will always get 1. Therefore, the solution to a^(~a) will be a sequence of 1s. EX) 1011 & (~0

Algorithms and Data Structures/Algorithms 2022.06.11
1
더보기
프로필사진

Algorithms and Data Structures Research Blog https://www.linkedin.com/in/taeyang-kim/ https://github.com/brightlightkim

  • 분류 전체보기
    • Algorithms and Data Structu..
      • Algorithms
      • Data Structures
      • Coding Practices
    • AI
    • AWS
      • EC2
      • ECS
      • CDK
      • X-Ray
      • Cloud Practitioner Certific..
      • Global Infrastructure and R..
      • Networking
      • Storage and Databases
      • Security
      • Monitoring and Analytics
      • Pricing and Support
      • Migration and Innovation
    • Rust
    • Node.js
      • Jest
      • Joi
      • Express
    • Serverless
    • Docker
    • Mongo
    • React
      • Next.js
    • Vue.js
      • Vuex
      • Nuxt
    • Coding Languages
      • JavaScript
      • TypeScript
      • Python
    • Internet of Things (IoT)
      • Arduino
      • Circuits
    • Basic Coding Info
      • Git
      • Monorepo
    • Testing
    • Bug
      • Git
      • AWS
      • JavaScript
      • Node
    • BYU-Broadcast
      • ScreenSharing
      • Bi-Weekly Training
      • Sprint
    • Security
    • Flutter
    • Android_App
      • Front-end
      • Back-end
      • RxJava
    • Web
      • CSS

Tag

vue.js, javascript, vuex, Docker, VUE, EC2, ECS, node, serverless, Node.js, AWS, Amazon, JEST, AI, lambda, Git, cdk, S3, BST, ML,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/07   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바