Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8883341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:47:24+00:00 2026-06-14T20:47:24+00:00

I was posed this question at an interview and never really came up with

  • 0

I was posed this question at an interview and never really came up with a great solution. Does anyone have an “optimum” solution? Where the target is efficiency and being able to deal with large input.

Material Provided:

I am given a long list of shops and their opening/closing times (say 1000).

The Problem:

For a given time of day, return how many of the shops are open

Example Data:

Sainsburys 10:00 23:00
Asda 02:00 18:00
Walmart 17:00 22:00

Example In/Out

Input | Output
12:00 | 2
22:00 | 1 (walmart shut @ 22:00)
17:30 | 3

The two parts of the problem are how to store the data and how to efficiently get the answer, I guess how you’re reading the input etc doesn’t really matter.

Thanks for your time and insight!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:47:25+00:00Added an answer on June 14, 2026 at 8:47 pm

    Let’s take a stab:

    //First, we turn the time input into an int and then compare it to the open and
    //closing time ints to determine if the shop is open. We'l use 10:00 in this example.
    //get magic time int
    int magicTimeInt = CInt("10:00".Replace(":",""));
    int openstorecount = 0;
    foreach(var shoptime in ShopTimesList)//SHopTImesList is the list of shop names and times
    {
        string[] theShop = shoptime.Split(" ");
        if( CInt(theshop[1].ToString().Replace(":", "")) < magicTimeInt 
        && 
        CInt(theshop[2].ToString().Replace(":", "")) > magicTimeInt)
        {
            openstorecount++;
        }
    }
    Console.WriteLine("10:00 | " + openstorecount.ToString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really hope this is not a question posed by millions of newbies, but
this was an interview question posed to me..I vaguely answered it uses Java reflections..but
I have seen this question posed regarding Silverlight 2 but I have not seen
This is a question posed to me in an interview. A single linked list
I recently came across this interview question (posted in a forum somehwere... looks like
I've seen this question posed once or twice before, but never with an answer
This question sounds similar to many posed here, but it's obnoxiously different. I have
A co-worker posed this question to me, and I told them, No, you'll need
This is somewhat related to the question posed in this question but I'm trying
This question is directly related to this SO question I posed about 15 minutes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.