Bros

leetcode.com/problems/add-two-integers/

Attached: Screen Shot 2022-05-28 at 1.10.48 PM.png (1486x1576, 531.22K)

>No Solution for this question
It's impossible. Its over

Yep

class Solution {
public:
int sum(int num1, int num2) {
int sum = 0;

if (num1 > 0) {
for (int i = 0; i < num1; i++) {
sum++;
}
} else {
for (int i = 0; i > num1; i--) {
sum--;
}
}

if (num2 > 0) {
for (int j = 0; j < num2; j++) {
sum++;
}
} else {
for (int j = 0; j > num2; j--) {
sum--;
}
}


return sum;
}
};

you would never have to dot his by hand outside of research experiments
don't stress over it, there are plenty ty of libs you can download to do the heavy lifting and protip: the labs will do this far more effectively than 99% of g will ever manage

fuck you I was thinking of doing the same thing lmao
def sum_of_two_ints(a, b):
s = 0
if a < 0:
for x in range(a, 0):
s = s - 1
else:
for x in range(0, a):
s = s + 1

if b < 0:
for x in range(b, 0):
s = s - 1
else:
for x in range(0, b):
s = s + 1
return s

Sirs here is most needfullest solution
part uno
class BrainBean
{
public String ob;
private int ptr;

private int length = 65535;

private byte memory[] = new byte[length];
private String out;

public void setOut(String stream)
{
out = stream;
}

public String getOut()
{
return out;
}

public void interpret(String s)
{
int c = 0;
int loc = 0;

for (int i = 0; i < s.length(); i++)
{
if (s.charAt(i) == '>')
{
if (ptr == length - 1)
{
ptr = 0;
}
else
{
ptr = ptr + 1;
}
}

else if (s.charAt(i) == '

Attached: bean.png (629x312, 37.82K)

part dos
e (c > 0 || s.charAt(i) != ']')
{
if (s.charAt(i) == '[')
{
c = c + 1;
}
else if (s.charAt(i) == ']')
{
c = c - 1;
}
i = i + 1;
}
}
}

else if (s.charAt(i) == ']')
{
if (memory[ptr] != 0)
{
i = i - 1;
while (c > 0 || s.charAt(i) != '[')
{
if (s.charAt(i) == ']')
{
c = c + 1;
}
else if (s.charAt(i) == '[')
{
c = c - 1;
}
i = i - 1;
}
i = i - 1;
}
}
}
}
}

class BrainBeanFactory
{
public BrainBean getBrainBean(String BrainBeanStream, String BeanString, String BrainOut)
{
BrainBean bean;
bean = new BrainBean();
bean.ob = BrainBeanStream;
bean.setOut(BrainOut);
bean.interpret(BeanString);
return bean;
}
}

class NumberAdder
{
public boolean doNeedful;

public String addNumbers(String num1, String num2)
{
BrainBeanFactory factory;
factory = new BrainBeanFactory();
BrainBean bean;
String output = "";
String input;
if (num1.charAt(0) == '-')
{
if (num2.charAt(0) == '-')
{
input = num1.split("-")[1] + "+" + num2.split("-")[1] + "=";
}
else
{
input = num1.sp

part tres
lit("-")[1] + "-" + num2 + "=";
}
}
else if (num2.charAt(0) == '-')
{
input = num1 + "-" + num2.split("-")[1] + "=";
doNeedful = true;
}
else
{
input = num1 + "+" + num2 + "=";
}
bean = factory.getBrainBean(input, "+>+>+>+>>>,.>++++[-]+[-]++++[-]+[-[--[--[[-]]]]],.>++++[-]+[-]++++[-]+>+[-]+>+->>+-[-]]>++++[-]]]>++++[-]>++++[-]>++++[-]]>++++[-]]]>++++[-]]

That's pretty much impossible in C.
To do it safely I mean.

>faster than 46.20% of submissions
woah

part four
ublic int getSum()
{
return sum;
}

public void setSum(int num1, int num2)
{
NumberAdderFactory factory;
factory = new NumberAdderFactory();
NumberAdder adder;
adder = factory.getNumberAdder();
String strsum;
String strnum1;
String strnum2;
strnum1 = Integer.toString(num1);
strnum2 = Integer.toString(num2);
strsum = adder.addNumbers(strnum1, strnum2);
String answer;
answer = strsum.split("=")[1];
if (adder.doNeedful == true)
{
if (answer.charAt(0) != '-')
{
answer = "-" + answer;
}
else
{
answer = answer.split("-")[1];
}
if (strnum2.charAt(0) == '-')
{
if (strnum1.charAt(0) != '-')
{
try
{
answer = answer.split("-")[1];
}
catch (Exception e)
{
answer = "-" + answer;
}
}
}

}
sum = Integer.parseInt(answer);
}

private int sum;
}

class SumBeanFactory
{
public SumBean getSumBean(int num1, int num2)
{
SumBean sumbean;
sumbean = new SumBean();
sumbean.setSum(num1, num2);
return sumbean;
}
}

class SolutionBean
{
public void sum(int num1, int num2)
{
SumBeanFactory beanfactory;
SumBean bean;
beanfactory = new SumBeanFactory();
bean = beanfactory.getSumBean(num1, num2);
solution = bean.getSum();
}

public int getSolution()
{
return solution;
}

private int solution;
}

class SolutionBeanFactory
{
public SolutionBean g

and last part sir
etSolutionBean(int num1, int num2)
{
SolutionBean bean;
bean = new SolutionBean();
bean.sum(num1, num2);
return bean;
}
}

class Solution
{
public int sum(int num1, int num2) {
SolutionBeanFactory factory;
factory = new SolutionBeanFactory();
SolutionBean solution;
solution = factory.getSolutionBean(num1, num2);
int answer;
answer = solution.getSolution();
return answer;
}
}

>faster than 46.2%
Sirs...

Attached: indian-browser.jpg (675x1200, 135.74K)

package leet;

import java.util.ArrayList;
import java.util.List;

class AddTwo {
public static int sum(int num1, int num2) {
List plussies = new ArrayList();
List minussies = new ArrayList();
while(num1 != 0 || num2 != 0) {
if (num1 > 0) {
num1--;
plussies.add('+');
}
if (num2 > 0) {
num2--;
plussies.add('+');
}
if (num1 < 0) {
num1++;
minussies.add('-');
}
if (num2 < 0) {
num2++;
minussies.add('-');
}
}
while (plussies.size() > 0 && minussies.size() > 0) {
plussies.remove(0);
minussies.remove(0);
}
int num_plussies = 0;
int num_minussies = 0;
while (plussies.size() > 0 || minussies.size() > 0) {
if (plussies.size() > 0){
plussies.remove(0);
num_plussies++;
}
if (minussies.size() > 0){
minussies.remove(0);
num_minussies++;
}
}
if (num_plussies > 0) {
return num_plussies;
} else {
return -num_minussies;
}
}
}

>import numpy

return num1 + num2 + 1


sorry there might be an off-by-one error, I always fuck these up

Kek

Attached: 002.jpg (500x373, 29.64K)

if OP scrolled down a bit we'd see the constraints of the problem are -100

Oh, that's easy then.
if (num1 == -100 && num2 == -100) ...

class Solution:
def sum(self, num1: int, num2: int) -> int:
import random
while True:
num1_plus_num2 = random.randint(-200, 200)
if num1_plus_num2 - num1 == num2:
return num1_plus_num2

Attached: Screen Shot 2022-05-28 at 6.18.56 PM.png (501x181, 32.96K)

Getting into that 1% is hard, huh.

This is sleepsort tier