Microsoft Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
2
of 2 vote

888
88
8
8
8
----------
1000

- Anonymous October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

888
88
+ 8
8
8
---------
1000

- vishal March 21, 2021 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

can we implemented any programming language?

- bhargavi July 21, 2021 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Guys this is not a puzzle,
they are asking you to sort out an algo for the problem
Finding the result is not the point..

- erm October 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

yes u r right ern, this is a typical subset sum problem ...
scan the the values ...and store them...
after scanning first 2 8's list should be ..16,88
after scanning first 3 8's list should be ...24,96,888
we can find the soln if we proceed in this way...

- Anonymous October 22, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

ok ,thank you.

- Anonymous July 21, 2021 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

888
 88
  8
  8
  8
----------
1000

- Anonymous October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

with no order of operation:
8+8*8*8+8-8-8-8-8
8+8*8*8-8+8-8-8-8
8+8*8*8*8/8-8-8-8
8+8*8+8-8*8-8-8-8
8+8*8-8+8*8-8-8-8
8+8*8*8/8*8-8-8-8
8+8+8-8*8*8-8-8-8
8+8-8+8*8*8-8-8-8
8-8+8+8*8*8-8-8-8
8*8/8+8*8*8-8-8-8
8/8*8+8*8*8-8-8-8
8+8*8/8*8*8-8-8-8
8+8/8*8*8*8-8-8-8
8+8*8*8-8-8+8-8-8
8+8*8*8-8*8/8-8-8
8+8*8*8-8/8*8-8-8
8+8*8*8-8-8-8+8-8
8+8*8*8-8-8*8/8-8
8+8*8*8-8-8/8*8-8
8+8*8*8-8-8-8-8+8
8+8*8*8-8-8-8*8/8
8+8*8*8-8-8-8/8*8

- Restless October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

with no order of operation:
8+8*8*8+8-8-8-8-8
8+8*8*8-8+8-8-8-8
8+8*8*8*8/8-8-8-8
8+8*8+8-8*8-8-8-8
8+8*8-8+8*8-8-8-8
8+8*8*8/8*8-8-8-8
8+8+8-8*8*8-8-8-8
8+8-8+8*8*8-8-8-8
8-8+8+8*8*8-8-8-8
8*8/8+8*8*8-8-8-8
8/8*8+8*8*8-8-8-8
8+8*8/8*8*8-8-8-8
8+8/8*8*8*8-8-8-8
8+8*8*8-8-8+8-8-8
8+8*8*8-8*8/8-8-8
8+8*8*8-8/8*8-8-8
8+8*8*8-8-8-8+8-8
8+8*8*8-8-8*8/8-8
8+8*8*8-8-8/8*8-8
8+8*8*8-8-8-8-8+8
8+8*8*8-8-8-8*8/8
8+8*8*8-8-8-8/8*8

- Restless October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8 8 8 + 8 8 + 8 + 8 + 8 = 1000

- gulusworld1989 October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

888 + 88 + 8 + 8 + 8 = 1000, but doesn't it look to simple?

- airfang613 October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

888 + 88 + 8 + 8 + 8 = 1000, but doesn't it look to simple?

- airfang613 October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

can't believe MS asking such crap questions

- DP October 17, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I cant believe they asked this question in an interview. It is an NP complete problem, isn't it?

- Pranz October 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Plus88888888
{
class Program
{
static void PrintArray(int[] arr, int index)
{
Console.Write("{0} ", arr[0]);
for (int i = 1; i < index; i++)
{
Console.Write(" + {0}", arr[i]);
}
Console.WriteLine();
}
static int CalculateValue(int n)
{
int result = 0;
for (int i = 0; i < n; i++)
{
result = (result * 10) + 8;
}
return result;
}
static void CalculateEightEights(int numEightLeft, int[] arr, int index, int currentResult)
{
int tmp = 0;
if (numEightLeft == 0)
{
if (currentResult == 1000)
{
PrintArray(arr, index);
return;
}
}
for (int i = 1; i <= numEightLeft; i++)
{
tmp = CalculateValue(i);
arr[index] = tmp;
CalculateEightEights(numEightLeft - i, arr, index+1, currentResult+tmp);
}
}
static void Main(string[] args)
{
int[] arr = new int[8];
CalculateEightEights(8, arr, 0, 0);
}
}
}

- Anonymous November 11, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

@Anonymous, cud u plz explain the code? I dont think this code will work. It will sum up eight 8s, four 88s, two 888s,... so on.
Am I missing something obvious?

- ms November 19, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

I am modifying Anonymous code as follows:

int[] arr = new int[8];
   int index = 0;

   void calculateEightEights(int target, int numEightLeft)
   {
       int prevResult = 0, curResult = 0;
       for (int i=1; i<=numEightLeft; i++)
       {
           curResult = (curResult * 10) + 8;
           if (curResult > target)
           {
               arr[index++] = prevResult;
               calculateEightEights(target - prevResult, numEightLeft - i + 1);
           }
           prevResult = curResult;
        }
    }

    To invoke the method: calculateEightEights(1000,8);

For simplicity I have taken global variables. We can avoid using them as found in anonymous code.
Hope this would help. Let me know the bugs,if any.

Thanks.

- ms November 19, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

add eight 8s and add 36 '++'

- thecodemaster November 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

It wont work.. Required result is 1000.. not 100.

- sp November 19, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

888+88+8+8+8...so simple yaar..

- prasathsarath December 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think first is to recognize that to get a zero in the one's place you need 5 8s, i.e., 5 terms to be added. The next is that to get to 1000 you're going to need a big number (888). The rest is even simpler.

- Frank January 27, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

8+8+8+88+888=1000

- abhishek February 20, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{[(8+8)*8]-[(8+8)/8]}*8-8=1000,so i m genious

- Raj Rana March 22, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

great

- maci lewis December 12, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8
8
8
88
888=1000

- vinitha March 09, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8 8+8+88+888=1000

- chetana surywanshi February 03, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

888
88
8++
8
8

1000

- pallab October 25, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

namespace Plus88888888
{
class Program
{
static void PrintArray(int[] arr, int index)
{
Console.Write("{0} ", arr[0]);
for (int i = 1; i < index; i++)
{
Console.Write(" + {0}", arr[i]);
}
Console.WriteLine();
}
static int CalculateValue(int n)
{
int result = 0;
for (int i = 0; i < n; i++)
{
result = (result * 10) + 8;
}
return result;
}
static void CalculateEightEights(int numEightLeft, int[] arr, int index, int currentResult)
{
int tmp = 0;
if (numEightLeft == 0)
{
if (currentResult == 1000)
{
PrintArray(arr, index);
return;
}
}
for (int i = 1; i <= numEightLeft; i++)
{
tmp = CalculateValue(i);
arr[index] = tmp;
CalculateEightEights(numEightLeft - i, arr, index+1, currentResult+tmp);
}
}
static void Main(string[] args)
{
int[] arr = new int[8];
CalculateEightEights(8, arr, 0, 0);
}
}
}

- Anonymous November 02, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8+8+8+8+8+8+8+8+8+8+8
+8×0+8= 96

But doesn't it look like 8

- Jo March 27, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

(8888-888)/8

- Sriyuktha April 24, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8+8+8+8+8+8+8+8=1000 มีวิทีอย่างไร?

- Anonymous May 05, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Mahendra Singh Gurjar

- Mahendra Gurjar July 08, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8888-88/8=1000

- Ajmal Hossain October 20, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

888+88+8+8+8=1000

- Ajmal Hossain October 20, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

888+88+8+8+8=1000

- Anonymous October 20, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Kdsfs

- ksxfwa November 11, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8+8+8+8+8+8+8+8=1000

- sushmitha December 27, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8+8+8+8+8+8+8+8=1000

- sushmitha December 27, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

ty 
bvj,bl
kn,lolnhn n;lg
     vjgbpfjmbl;f
ncladsssss  d c dxkcac aknlnjp;[k;

- Anonymous March 05, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

(8*8)-(8+8/8)*(8+8)+8=1000

- Ankeet April 23, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Admin

- Admin June 07, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use the number 8

- Anonymous June 29, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use the number 8

- Tohid June 29, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

(8888-888)/8

- Rishika July 14, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Plus88888888
{
class Program
{
static void PrintArray(int[] arr, int index)
{
Console.Write("{0} ", arr[0]);
for (int i = 1; i < index; i++)
{
Console.Write(" + {0}", arr[i]);
}
Console.WriteLine();
}
static int CalculateValue(int n)
{
int result = 0;
for (int i = 0; i < n; i++)
{
result = (result * 10) + 8;
}
return result;
}
static void CalculateEightEights(int numEightLeft, int[] arr, int index, int currentResult)
{
int tmp = 0;
if (numEightLeft == 0)
{
if (currentResult == 1000)
{
PrintArray(arr, index);
return;
}
}
for (int i = 1; i <= numEightLeft; i++)
{
tmp = CalculateValue(i);
arr[index] = tmp;
CalculateEightEights(numEightLeft - i, arr, index+1, currentResult+tmp);
}
}
static void Main(string[] args)
{
int[] arr = new int[8];
CalculateEightEights(8, arr, 0, 0);
}
}
}

- Anonymous August 19, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

((8*8)+(8*8))8-8-8-8

- Divya October 11, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8*8*(8+8)-(8+8+8)

- Sankar November 22, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Bdhdhfjfbjf

- Sankar November 22, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Add no 8 for 7 times so answer will be 1000

- Anonymous February 13, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Add no 8 for 7 times so answer will be 1000

- Anonymous February 13, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

8888 - 888 ÷ 8 =1000

- Anjaney April 10, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

( ( ((8+8)*8)- (8+8+8)/8) ) *8)

- sudarson October 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

You can only use '+' operator.
I think its pretty simple.
888+ 88+ 8 + 8 + 8 = 1000

- ManishSindhi October 16, 2010 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More