Qualcomm interview question

2 programming questions, one in java and one in C