Arquivo

Posts Tagged ‘Prova’

Solução para o teste EQUI no Codility

Muitas pessoas estão fazendo testes / provas online no Codility como parte de entrevistas de emprego, principalmente, para vagas no exterior. Eu recomendo fazer os tutorias antes de tentar fazer qualquer teste oficial lá, pois somente assim, você vai ver como realmente é a prova, como rodar, testar, e dessa forma, sentir-se confortável com a mesma.

Eu efetuei o teste EQUI, que tem a solução em C aqui. Resolvi em JAVA. Recomendo tentar fazer antes de olhar a solução. Ai vai:


package br.com.ibm.tests;

public class Solution {

public static void main(String[] args) throws Exception {
Solution s = new Solution();
// int[] A = {2, 2, 2, 2, 2, 2, 2, 2, 2};
int[] A = { -7, 1, 5, 2, -4, 3, 0 };
System.out.print(s.solution(A));
}

public int solution(int[] A) {
int sub = 0;
int sum = 0;
int left = 0;
int right = 0;

if (A.length != -1) {
for (int i = 0; i < A.length; i++) {
sum = sum + A[i];
}
}

for (int i = 0; i < A.length; i++) {
sub = sub + A[i];
left = sub - A[i];
right = sum - sub;

if (left == right) {
return i;
}
}
return -1;
}

}

Uma solução mais performática e menos propensa a estouros utilizando BigInteger é:

package br.com.ibm.tests;

import java.math.BigInteger;

public class Solution {

public static void main(String[] args) throws Exception {
Solution s = new Solution();
// int[] A = {2, 2, 2, 2, 2, 2, 2, 2, 2};
int[] A = { -7, 1, 5, 2, -4, 3, 0 };
System.out.print(s.solution(A));
}

public int solution(int[] A) {
BigInteger sub = BigInteger.ZERO;
BigInteger sum = BigInteger.ZERO;
BigInteger left = BigInteger.ZERO;
BigInteger right = BigInteger.ZERO;

if (A.length != -1) {
for (int i = 0; i < A.length; i++) {
sum = sum.add(BigInteger.valueOf(A[i]));
}
}

for (int i = 0; i < A.length; i++) {
sub = sub.add(BigInteger.valueOf(A[i]));
left = sub.subtract(BigInteger.valueOf(A[i]));
right = sum.subtract(sub);

if (left.equals(right)) {
return i;
}
}
return -1;
}

}

Boa sorte.

Categorias:JAVA Tags:, , , ,

Depoimento de um aluno contratado pela IBM

Pessoal, um aluno publicou um depoismento no Blog da IBM contando como foi o processo.

Pode ser bem interessante para quem quer entrar no mercado.

O mesmo fala do processo de entrevista, prova, etc.

Eis o link.

Certificação em WebShere Application Server

was_cert Os alunos participantes do Academic Initiative sempre me perguntam sobre certificação em WebSphere e eu prometi que colocaria alguns links aqui. Pesquisando no site da IBM encontrei um ROADMap muito bom! Ele mostra certinho os passos a seguir. Esta: http://www-03.ibm.com/certify/certs/ws_index.shtml é a página principal sobre certificação em WAS.

Estou começando a estudar um pouco e pretendo fazer a prova em Fevereiro/Março do ano que vem. Já fiz alguns simulados e parece não ser difícil.

Se alguem procura algum companheiro de estudos, conte comigo!