How to add two numbers without using (+) operator?

How to add two numbers without using (+) operator?

If you are Preparing for your Interview. Even if you are settled down in your job, keeping yourself up-to-date with the latest Interview Problems is essential for your career growth.

If you are Preparing for your Interview. Even if you are settled down in your job, keeping yourself up-to-date with the latest Interview Problems *is essential for your *career growth. Start your prep *from *Here!

Last month, I have been researching to find out the Frequently asked problems from these Companies. I have compiled *100 *of these questions, I am not promising you that you will get these questions in your interview but I am confident that most of these “interview questions” have similar logic and employs the same way of thinking from these set of challenges.

Before we move on to the first problem, If you are wondering why I chose LinkedIn, Yahoo and Oracle over FAANG are because I have completed a challenge Focusing on Amazon and Facebook Interview.

New Day, New Strength, New Thoughts🚀

Day 32 — Add 2 Numbers🏁

AIM🏹

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

Example🕶

Input: a = 1, b = 2
Output: 3

FollowHouse of Codes_ for keeping up to date in the programming interview world._

Code👇

class Solution {
         public int getSum(int a, int b) {
            if (a == 0) return b;
            if (b == 0) return a;

            while (b != 0)  {
                int carry = (a & b) << 1;
                a = a ^ b;
                b = carry; 
            }
            return a;
        }
    }
view raw
getSum.java hosted with ❤ by GitHub

Edge Cases

  1. If any one of the given number is zero, return the other number.

software-development coding programming java interview visual studio code

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Offshore Software Development - Best Practices

To make the most out of the benefits of offshore software development, you should understand the crucial factors that affect offshore development.

Development Containers in Education with Visual Studio Code

Development Containers in Education with Visual Studio Code

How to Develop an ASP.NET Core Application Using Visual Studio Code

Visual Studio Code (VS Code) is a free, cross-platform, and lightweight source-code editor developed by Microsoft for Windows, Linux, and Mac operating systems. It is a source-code editor while Visual Studio is an IDE (integrated development environment). VS Code supports development operations such

5 Core Criteria for Selecting Software Development Company - TopDevelopers.co

Check out these five criteria for the selection of your software vendor, and you will never regret having the wrong quality product made for you.

3 Best Programming Languages for Java Developers

In this article, I’ll share 3 JVM Programming languages Java programmers can learn and why you should learn them. Being a Polyglot developer is of good quality and often valued highly in interviews.