We have 4 cameras “camA”, “camB”, “camC”, “camD” installed at every junction along a road and in this sequence. The flow of traffic is such “camA” is at the beginning, and “camD” is at the end. Whenever a vehicle passes a junction or makes a turn at the junction, the camera is positioned to record down the license plate number.
Tag: algorithm
calculate the digits of the Nth number using the given numbers [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago. Improve this question I’d like to get the digits of the Nth number by using the given numbers which are 3 and 9.
Time limit exceeded when finding tree height
this is my code to find the height of a tree of up to 10^5 nodes. May I know why I get the following error? Warning, long feedback: only the beginning and the end of the feedback message is shown, and the middle was replaced by ” … “. Failed case #18/24: time limit exceeded Input: 100000 Your output: stderr:
Algorithm to position diners at a table with social distancing guidelines
Trying to solve this task: A cafeteria table consists of a row of N seats, numbered from 1 to N from left to right. Social distancing guidelines require that every diner be seated such that K seats to their left and K seats to their right (or all the remaining seats to that side if there are fewer than K)
Remove part of the string between the comments along with the comments
Here’s a string. I want to remove a C-style comments with the comments itself. Without using regex I want the output to be just: word234 Answer Here is a simple algorithm that keep the state over 2 characters and uses a flag to keep or not the characters. Output: If you want to handle nested comments (not sure if this
How to write a search function to get the path of the desired file?
I have a directory structure that looks like the image. This structure is organised in a form of objects. File objects are each in the form: {type:’file’, name:’file a1′} for example. Folderobjects are like File objects, but they have an extra key children which is an array of sub folders/files. Here’s a console log of the rootFolder object from the
Find match of numeric arrays Python
Consider I have 2 arrays. arr2 will always be longer than arr1. I’d like to drop the values from arr2 to best fit arr1. If arr2 doesn’t have an equal value to arr1 it will need to be the closest value that is still in arr2. observing the output. the first value is 0, both have a match at the
How to convert a char array to a number for sorting?
Let’s say I have three words I want to sort: hello goodbye alex And alphabetically it’d be sorted ascendingly as [“alex”, “goodbye”, “hello”]. Is there a way to convert the string (limited to 100 characters)? For example, if I have: And I use ord to get the code for each list element: How would I create a number from that,
Strictly Increasing Path in Grid with Python
At each step we can go the one of the left,right,up or down cells only if the that cell is strictly greater thab our current cell. (We cannot move diagonally). We want to find all the paths that we can go from the top-left cell to the bottom-right cell. [[1,4,3], [5,6,7]] In our example, these paths are 1->4->6->7 and 1->5->6->7.
stable match algorithm for different sizes groups and limited places
I want to write a program that oriented student to their specialty in university depending on their choices and their range in the specialty. each specialty can take multiple student (in this case cnm =1 , dsi=2 , rss=2),and the number of student can be more than the number of places (in this case one student not gonna have a