Microsoft México convoca a Desarrolladores
Así es amigos del Dr. Microsoft , apuntate , haz tu examen y se parte de Microsoft.
Te recomiendo ampliamente que mandes tus datos ¡¡¡
Recomiendo que leas el libro : Programming Interviews Exposed
que puedes conseguir en el siguiente link:
Aquí les dejo una serie de problemitas para
practicar previo al reto.
//
What does Bar do?
static
bool Bar(int[] buffer, int x, int a, int b)
{
int c = 0;
while (a > b)
{
c = (a + b) >> 1;
if (x == buffer[c])
{
break;
}
else if (x > buffer[c])
{
b = c + 1;
}
else
{
a = c - 1;
}
}
return x == buffer[c];
}
//
Can you find the problems?
void
ConvertDaysSince1980ToYearDays(int storedDays, int& currentYear, int&
currentDays)
{
int year = 1980; int days = storedDays;
while (days > 365)
{
if (IsLeapYear(year))
{
if (days > 366)
{
days -= 366; year += 1;
}
}
else
{
days -= 365; year += 1;
}
}
}
Top of Form
//
What does Foo do?
void
Bar(int * pElement) {
int * pTemp = pElement + 1;
if ((*pElement) > (*pTemp)) {
(*pElement) ^= (*pTemp);
(*pTemp) ^= (*pElement);
(*pElement) ^= (*pTemp);
}
}
void
Foo(int *array, int length) {
int i, j;
for (i = length - 1; i > 0; i--) {
for (j = 0; j < i; j++){
Bar(&array[j]);
}
}
}
//
Can you find the problems?
int
strToInt(char* pBuffer)
{
int num = 0;
bool isNeg = true;
if (*pBuffer == '-')
{
isNeg = true;
}
while (pBuffer)
{
num *= 10;
num += (*pBuffer) - '0';
pBuffer++;
}
if (isNeg) num *= -1;
return num;
}
//
What is printed?
#define
Sum(a,b)\
a + b
int
_tmain(int argc, _TCHAR* argv[])
{
int val1, val2, result;
val1 = 2; val2 = 3;
result = Sum(val1++, val2++);
printf("val1=%u, val2=%u, result=%u\r\n",
val1, val2, result);
val1 = 2; val2 = 3;
result = Sum(++val1, ++val2);
printf("val1=%u, val2=%u, result=%u\r\n",
val1, val2, result);
return 0;
}
//
What does Baz do?
static
void Baz(int[] buffer, int a, int x, int y)
{
if (x >= y)
{
return;
}
int value = 0; int i = x;
while (i < a)
{
if (buffer[i] > buffer[a])
{
value = buffer[i];
buffer[i] = buffer[a - 1];
buffer[a - 1] = buffer[a];
buffer[a] = value;
a--; i--;
}
i++;
}
Baz(buffer, a - 1, x, a - 1);
Baz(buffer, y, a + 1, y);
}
//
Can you find the problems?
class
Node { Node* pNext; int value; };
HRESULT
DuplicateLinkedList(Node* pInput, Node** pNewList)
{
HRESULT hr = S_OK; Node** pTemp; Node* pHead;
*pTemp = &pHead;
while(pInput)
{
pTemp = new Node();
if (pTemp == NULL)
{
hr = E_FAIL; goto Error;
}
(*pTemp)->value = pInput->value;
pInput = pInput->pNext;
(pTemp) = &((*pTemp)->pNext);
}
*pNewList = &pHead;
Error:
return hr;
}
Espero ver a muchos por acá ¡¡¡
Anexo un Sample para hacer curriculum en Inglés
Cualquier duda que tengas no dudes en comentar el post y con gusto lo checamos.