Help a nigga with his coding assignment

Any idea how i can stop this from throwing an index out of bound exception in the second for loop. Assuming the array has integers in it.

...

use spacebar you double nigger

He wrote pos

If all your values Match to Foo, your match integer will grow bigger than the Array.

maybe you should drop out

The second for loop is useless. You probably have an infinite loop because the condition is never met then you start indexing out of bounds indices.

>useless if statement
You're better off shoplifting, Jamal.

Heh, yeah.

Instead,

return ans >= k;

its a Boolean return i need to check if their is consecutive integers (one after the other). The if statement is to check how many times there are consecutive integers and if its at least the the or equal to the provided number (k)

what font is that?

Yes. ans

I see what you mean thanks for the advice, im going to go drop out though

What are you trying to achieve with this code?

Your codestyle is awful. Consider using some lints.

Try looking at the code you wrote when you first started.

foo is uninitialized. This means it can be anything from -INT_MAX to +INT_MAX. Most of these values are out of bounds.

Color theme OP?

the first for loop is useless. You will only ever check the first element and then return.

>foo = values[pos]

What are you trying to do exactly?

>drop out
Don't be a pussy.

You're not checking wether you're still in bonds in the second loop, use "values[match]==foo && match

Color Theme is sublime text monokai extended
Appearance is MoonRise (standalone)