Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (konradzuse):

I'm here for Java help, let me know if anyone needs anything. I scroll around the group, but sadly most of it is Python and non-comp sci stuff :(.

OpenStudy (anonymous):

u can try and ask :)

OpenStudy (anonymous):

Hi, I may require your assistance with some of my Java programs.

OpenStudy (konradzuse):

@xaadi I don't need to ask, I'm here to tell.

OpenStudy (anonymous):

that's good

OpenStudy (g152xx):

@KonradZuse where were you when I took my twitter online interview with the 2 sets of problems each 30 min timed??

OpenStudy (konradzuse):

Right here :p.

OpenStudy (g152xx):

I already passed with 120 points from 200 but u wanna see one problem? Java ofcourse.

OpenStudy (konradzuse):

kk

OpenStudy (g152xx):

A non-empty zero-indexed array A consisting of N integers is given. A pair of integers (P, Q) is called K-complementary in array A if 0 ? P, Q < N and A[P] + A[Q] = K. For example, consider array A such that: A[0] = 1 A[1] = 8 A[2]= -3 A[3] = 0 A[4] = 1 A[5]= 3 A[6] = -2 A[7] = 4 A[8]= 5 The following pairs are 6-complementary in array A: (0,8), (1,6), (4,8), (5,5), (6,1), (8,0), (8,4). For instance, the pair (4,8) is 6-complementary because A[4] + A[8] = 1 + 5 = 6. Write a function: class Solution { public int complementary_pairs(int K,int[] A); } that, given an integer K and a non-empty zero-indexed array A consisting of N integers, returns the number of K-complementary pairs in array A. For example, given K = 6 and array A such that: A[0] = 1 A[1] = 8 A[2]= -3 A[3] = 0 A[4] = 1 A[5]= 3 A[6] = -2 A[7] = 4 A[8]= 5 the function should return 7, as explained above. Assume that: N is an integer within the range [1..50,000]; K is an integer within the range [-2,147,483,648..2,147,483,647]; each element of array A is an integer within the range [-2,147,483,648..2,147,483,647]. Complexity: expected worst-case time complexity is O(N*log(N)); expected worst-case space complexity is O(N), beyond input storage (not counting the storage required for input arguments). Elements of input arrays can be modified

OpenStudy (g152xx):

or if you like this one better: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001) and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps. Write a function: class Solution { public int binary_gap(int N); } that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap. For example, given N = 1041 the function should return 5, because N has binary representation 10000010001 and so its longest binary gap is of length 5.Assume that: N is an integer within the range [1..2,147,483,647].

OpenStudy (konradzuse):

Lol such useless questions.....

OpenStudy (g152xx):

I know, but I had to resolve both in 60 minutes.

OpenStudy (konradzuse):

Yeah that's bs too. oh wells...

OpenStudy (g152xx):

Thanks anyways.

OpenStudy (konradzuse):

? Did you want me to solve them?

OpenStudy (g152xx):

No, no, it's useless now, no - thanks alot

OpenStudy (g152xx):

Just showing you how twitter tests are when you send your resume.

OpenStudy (konradzuse):

I think it's sad that interviewers ask such dumb questions. I' a part of a site called the Code Ranch, and one dude said an interviewer asked him what the "3 minor pillars of Java were." There were SOO MANY answers from guys who havebeen doing this for years, and professionals like Bear B, and Paul C, and Cambell....

OpenStudy (konradzuse):

Interviewers should ask questions that are legit, and actually pertain to something.. Give examples of real world crap, not this stuff that no one will ever use... I guess when you're onyl given an hour they give you some tricky q's.

OpenStudy (konradzuse):

One dude was telling me they askeds him about statics and some bs that was a trick Q.....

OpenStudy (konradzuse):

It's like you want Swing GUI's, FX, Open Gl, Databases, etc I can do it, but don't give me some stupid bs Q Lol :)

OpenStudy (g152xx):

exactly. but if you dont answer THEIR Q' you're irrelevant.

OpenStudy (konradzuse):

Yeah they suck I hate them :P. Good thing I wont have to work for any of them!

OpenStudy (g152xx):

Big Moose Saloon lool. Sounds fun.

OpenStudy (konradzuse):

:) The code ranch is the best, even though half of them have HUUUUUUUUUUUUUGE Egos.

OpenStudy (anonymous):

Can you make a simple code where there are two constructors that turns exactly the same thing ?

OpenStudy (konradzuse):

There are 3 sites I recommend. http://docs.oracle.com/javase/tutorial/index.html There is a also www.learnnowjava.com ; however that isnt' free like the Oracle Trail. www.CodeRanch.com also has a ton of professionals, but they wont do your code for you, just help you along the way.

OpenStudy (anonymous):

Any idea about JSP anyone?..I dont know anything about JSP and I am desperate to know. Where should I start from? Some video tutorials would be of great help. Do you know any website from where I can download JSP videos?

OpenStudy (konradzuse):

oracle trail has tuts on everything.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!