r/CS_Questions • • Feb 18 '18

Big 4 Q: Given a 2D char array of employees, where the first element of each array is a manager and the rest of the array are direct reports/subordinates, print the ranking of each employee.

9 Upvotes

Friend told me he was asked this recently at a Big 4 company. How do I go about approaching this? DFS?


r/CS_Questions • • Jan 21 '18

What's the difference between Graceful Degradation and Fault Tolerance?

9 Upvotes

Please explain with examples if possible! Thanks !


r/CS_Questions • • Nov 27 '17

Find the maximum contiguous subarray sum

Thumbnail
youtube.com
9 Upvotes

r/CS_Questions • • Oct 17 '17

Coding Interview Practice Videos

9 Upvotes

I recently started making videos of myself walking through coding interview questions, and I thought this sub might be interested in them. I mainly do this as a way to keep myself warmed up, so I don't have to cram when I decide I want to switch jobs and interview again.

 

Here are the videos I have so far:

Two sum: https://www.youtube.com/watch?v=WidSwL7oqX4

Linked list sum: https://www.youtube.com/watch?v=LsbczSEpkLg

 

Let me know if this is useful. I'm always interested in questions to solve for my next video, so if you have any requests feel free to leave it in a comment on this thread or in one of the videos!


r/CS_Questions • • Aug 27 '17

Create Maximum Arithmetic Expression

9 Upvotes

Your input is a double array, and you can use *, +, -, and () parenthesis anywhere to create and output the maximum possible value.

Ex: input is {3,4,5,1} --> output: 72

input is {1,1,1,5} --> output: 15

Follow up, if there are numbers <0

My solution N3 top down dynamic programming approach but I believe there is an O(n) algorithm that solves it. Anyone have any ideas?

        public static long max(int[] nums) {
    
            Long[][] memo = new Long[nums.length][nums.length];
            return max(nums, 0, nums.length - 1, memo);
    
        }
    
        public static long max(int[] nums, int i, int j, Long[][] memo) {
    
            if (memo[i][j] != null) return memo[i][j];
    
            if (i == j) {
                return nums[i];
            }
    
            long max = Integer.MIN_VALUE;
    
            for (int k = i; k < j; k++) {
    
                long left = max(nums, i, k, memo);
                long right = max(nums, k + 1, j, memo);
    
                for (char c : "*-+".toCharArray()) {
                    long res = apply(c, left, right);
                    max = Math.max(max, res);
                }
            }
    
            memo[i][j] = max;
    
            return max;
        }

r/CS_Questions • • Mar 21 '17

Data structures and algorithms problems in C++ using STL

Thumbnail
techiedelight.com
9 Upvotes

r/CS_Questions • • Mar 01 '17

A software engineer was detained by U.S. Customs — and given a test to prove he’s an engineer

Thumbnail
recode.net
9 Upvotes

r/CS_Questions • • Aug 30 '16

Are Interview Pre-Screen Problems Actually Hard Or Am I Just Stupid?

9 Upvotes

I've now bombed 3 interview pre-screening programming tests, all of them for Silicon Valley positions that I would kill for. I just finished one about 2 minutes ago and only managed to get one of my solutions compiling, much less pass any test cases.

A little background on me: I'm a fresh graduate from a small liberal arts college. However, I've been coding since early high school. I've created and deployed two mobile apps as part of medium sized teams, I've designed, developed, and deployed 3 clinical research tools, and I've at least touched each level of the stack at some point. I'm well versed in a variety of languages and I worked as a teaching assistant in the CS department at my school for 2.5 years. I am by no means an expert in any area but I'm no novice either.

To be clear, I'm not struggling coming up with solutions to the problems! After each of the exams I've continued my solution through completion, tested it, and found I was on the right track but simply behind on time.

I'd like to hear from everyone their experiences with screening exams: What level of experience do you have? How difficult do you find exams to be in general? Is it really just a matter of doing Topcoder and HackerRank until you can bang out solutions in time? I'm sick of losing out on great opportunities because I worked for 2 hours on problems only to find I run short 10 minutes of having a working solution.


r/CS_Questions • • Mar 08 '16

After spending 9 hours watching candidates bomb technical questions in interviews, I want to help some people out!

9 Upvotes

Technical questions can be made so much easier with a little instruction and practice. I've been lucky enough to have good instruction and I'd like to pass that on. If you want help learning to answer technical interview questions shoot me a PM and let's arrange a time to chat!


r/CS_Questions • • Nov 19 '11

Fibonacci - Easy, Medium, and Hard

9 Upvotes

Provide a function to calculate the nth Fibonacci number.

Easy:

Provide an iterative solution in linear time

Provide a recursive solution

Medium:

Provide a recursive solution in linear time

Hard

Provide a recursive or iterative solution in less than linear time

EDIT

Hard hint: Fibonacci numbers can be calculated by multiplying lower Fibonacci numbers. Figure out the formula and you can run in logarithmic time.


r/CS_Questions • • Nov 15 '11

Given a set of numbers, print out all permutations.

9 Upvotes

Given a set of numbers (you do not know the size or the numbers being used), print out all permutations of that set of numbers.

Example:
Input: 3-5-7
Output:

  • 3-5-7

  • 3-7-5

  • 5-3-7

  • 5-7-3

  • 7-3-5

  • 7-5-3

Bonus:
Also print out sub-permutations. Given the above input:

  • 3

  • 5

  • 7

  • 3-5

  • 3-7

  • 5-3

  • 5-7

  • 7-3

  • 7-5

  • 3-5-7

  • 3-7-5

  • 5-3-7

  • 5-7-3

  • 7-3-5

  • 7-5-3

Another bonus:
Do it iteratively, i.e., make a method iterate() that will return the next permutation without storing a list of permutations (storing the last permutation is fine) and loops around to the first permutation when iterate() is called on the last possible permutation.


r/CS_Questions • • Nov 13 '11

Integer Exponents [Easy]

9 Upvotes

Write a function which raises an integer to another integer. Do it both with loops and recursion.


r/CS_Questions • • Nov 13 '11

Google interview question: crossword

9 Upvotes

You are working on a crossword, and become fixated with one of the words. You have some of its letters figured out so far, but not all of them. E.g.:

"A.GO...H."

That, and a dictionary, are your inputs. Your output must be the set of words that are plausible solutions. (in the example, "ALGORITHM" + whichever other words fit there).

Can you beat linear time on the size of the dictionary? (Aclaration if you're inclined to answer "no": You can preprocess the dictionary into whatever data structure you want, and that doesn't count as part of your algorithm.)

Edit: It can also be done better than exponential on the size of the mistery word. (Thanks cgk ;) )

Enjoy :)


r/CS_Questions • • Oct 01 '23

How to watch your own CS2 matches

8 Upvotes

Hello everyone, I've been playing CS since the release of CS 1.6, but I never understood the system for watching the matches you played, can anyone help me? How can I watch the matches I played in Cs2?


r/CS_Questions • • May 11 '23

Free coding problems and solutions every week

Thumbnail
codinginterviewdigest.substack.com
8 Upvotes

r/CS_Questions • • Apr 03 '23

I’m worried that the Computer Science classes for a BS degree are too advanced for my current level of understanding. Should I switch gears or stay the course and learn more foundational information on my own time.

8 Upvotes

Hey everyone, I have a question that you all will hopefully have an answer to.

TLDR: I’m worried that the Computer Science classes for a BS degree are too advanced for my current level of understanding and I’m wondering if I can learn the basics from a CompTIA A+ book or other resource.

Wall of text version: Last year I decided to earn a degree in computer science, with the ultimate goal being to work in cybersecurity. Now, I can use a computer but I would say that I have no real IT experience or understanding of computers. I’d really like to learn more about the networking side, as I think that would give me good foundation to build upon.

I’m now 31, and I was in my late 20s when I started my college career. I have earned an Associates in Paramedic Studies, but the BS in computer science is the next step. When I took my entrance exam a few years ago, I did not pass the math section (namely because I hadn’t done any math in an academic setting for 10 or so years.) I’ve since taken all the remedial math classes needed to get caught up and am moving on to Calc and Analytic Geometry 1 for the upcoming fall semester. Once I learned the material again the math has been going well and I’m not too concerned about it so far.

As far as the computer side, I’m worried that the computer classes will be too advanced for me and I’ll have no clue what is going on. Looking at the other computer programs offered, like Information Systems and Technology or Information Assurance and Technology, the classes seem more geared towards beginners and the sort of stuff I’d like to learn. Some of them are:

CTS 110 - Network Essentials

CTS 120 - Introduction to Linux

CTS 140 - Network Security Fundamentals

CTS 234 - Windows Server

CTS 130 - Networking 1

CTS 131 - Networking 2

CTS 240 - Advanced Network Defense

CTS 242 - Network Intrusion Detection and Penetration Testing

CTP 114 - Python for Everyone

CTP 115 - Introductory Object-Oriented Program Analysis and Design

CTP 130 - Programming in PHP/MySQL

CTS 170 - Digital Forensics 1

CTS 216 - Network Forensics

CTS 222 - UNIX/LINUX System Administration

CTS 236 - Virtualization & Cloud

STM 213 - Professional Skills for STEM

Essentially, I’m worried that I won’t be prepared for the computer classes, and I’d like to learn what the classes I listed above offer but they are associates degrees. I feel like a BS in Computer Science degree will allow for more open doors in the future. Are these classes all things I could learn on my own time from something like a CompTIA A+ prep book, YouTube, etc?

Thanks!


r/CS_Questions • • Nov 13 '22

Happy Cakeday, r/CS_Questions! Today you're 11

8 Upvotes

r/CS_Questions • • Sep 15 '22

If I was looking to gain a knowledge base + skills required to build a tech. company, is it better to self-learn (YouTube, textbooks, blogs, google), bootcamp, or a CS degree?

8 Upvotes

r/CS_Questions • • Apr 19 '22

BS/BA CS Degree Advice

8 Upvotes

Hello, I am back in uni studying for a BS in CS and am nearing the point of the calculus and physics series. I've debated back and forth if it is worth the extra courses (calculus and physics). My university courses are the same in terms of CS courses, the main difference being the calculus/physics series. My desire is to work in one of the following areas data, software engineering/developer/programmer, and backend coding.

Does having a BS over a BA make a difference worth taking both series? I find myself struggling to focus on my CS courses because of the time spent understanding calculus. On top, I'm stressed daily with the family living in the war and a loved one recently passing. My main concern is failing courses and setting my graduation back. Looking for some advice (WA state if that helps). Thank you in advance.


r/CS_Questions • • Mar 06 '22

Should I apply for a Front-End Engineer, Software Engineer, or Full-Stack Engineer position as my first job after finishing a Full-Stack Software Engineering Bootcamp?

8 Upvotes

Hi everyone, I've nearly completed a Full-Stack Software Engineering Bootcamp in which I've learned the MERN full stack. When I finish this bootcamp, I'm wondering if I should apply for a Front-End Engineer, Software Engineer, or Full-Stack Engineer position as my first job?

I've seen some people online suggested that newcomers to the field of Software Engineering should find a Front-End Engineer job first, because companies wouldn't trust newbies to do Back-End stuffs. However, I want to learn as much as I can about both Front-End and Back-End on the job, because I think that this will benefit me more in my career and help me find out which one I want to specialize in. But actually, I'm also not sure if I should just specialize in either Front-End or Back-End or should I aim to be a Full-Stack Engineer instead?

Thank you in advance for your advice!


r/CS_Questions • • Nov 13 '21

Happy Cakeday, r/CS_Questions! Today you're 10

8 Upvotes

r/CS_Questions • • Apr 27 '21

I just bombed an easy test and have an interview tomorrow.

8 Upvotes

So I just took a coding test for a developer position that uses Angular, Java, JavaScript, HTML, & Progress (according to the job description). I did worse on that test than any I've ever taken before. The questions were pretty easy, but I always do worse under timed pressure, and I'm very out of practice with the languages they were testing for. It's an entry level position and I've never had a job in the industry before. I'm sick to my stomach trying to think of how to explain why I did so poorly on the test. Now I'm wondering if I should just cancel with them and withdraw my application, since there's probably zero chance of me getting an offer now anyway.


r/CS_Questions • • Feb 07 '21

good study material for Java interview questions ?

8 Upvotes

Can anyone please provide some good study material for preparation for Java interview questions ?


r/CS_Questions • • Dec 12 '20

What is the time complexity of a query operation in a search engine such as solr or elastic search? Is it constant or logarithmic?

8 Upvotes

I don't see a lot of info online on how Lucene builds and maintains the inverted index under the hood, but it sounds like it sorts the tokens and then relates each to the documents its related to. So with that approach, isn't a search going to be Olog(n)?


r/CS_Questions • • Sep 29 '20

What Is The Sliding Window Algorithm?

Thumbnail
medium.com
8 Upvotes