Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
I am attempting to do a coding challenge and I am not quite sure I understand the briefing.
Could someone please explain the following in simple terms, without giving me the solution?
Let's transform the sample into more a suitable format.
The first line contains information about how to process the input:
The first number (m) tells how many letter translation rules do you have
The second number (n) tells how many translation probes do you have
Lets add two horizontal lines to better separate segments
3 3
____
a c
b a
a b
____
aaa abc
abc aaa
acm bcm
Now let's introduce the -> notion for letter translation rule
3 3
____
a -> c
b -> a
a -> b
____
aaa abc
abc aaa
acm bcm
Finally let's introduce the ?-> notion for translation probe
3 3
____
a -> c
b -> a
a -> b
____
aaa ?-> abc
abc ?-> aaa
acm ?-> bcm
Your task is to check whether a given probe can be done by using the translation rules.
For example to verify the aaa ?-> abc probe you need the followings:
a: a
b: a -> c -> b
c: a -> c
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am doing my homework about Generic classes, I have created my data classes Student and Module, and List class List, everything is connected with nodes, I have Node class too, but that is not the case. I need to find how many modules each lecturer has(lecturer can have more than 1 module).
Let's say I have data about module:
Module name Lecturer name
Math AAAA
Physics BBBB
IT AAAA
So I need to find how many modules each lecturer has, because every lecturer can have more than 1 module, so the results should be:
AAAA - 2, BBBB - 1
it sounds like something like:
var grouped = list.GroupBy(x => x.LecturerName);
foreach(var grp in grouped)
{
Console.WriteLine($"{grp.Key}: {grp.Count()}");
}
should work?
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have admission table which contains the following data :
Std_Id Name Class
1 ali one
2 jack two
3 adam one
4 john two
5 tris one
6 bill two-I
7 sarah one-I
8 josh two-I
9 alex one-I
I want to show the list such that the record having the same class must be shown consecutively ,something like this :
Std_Id Name Class
2 jack two
4 john two
1 ali one
3 adam one
5 tris one
6 bill two-I
8 josh two-I
7 sarah one-I
9 alex one-I
How can i create the above list using linq.I'm using entity framework 6.0.
This is what i'm trying...
db.Admissions.GroupBy(d=>d.ClassId).ToList();
Db.Admissions.OrderBy(od=>od.ClassID)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Improve this question
I want to strip out continues number string using regex from a text field minimum 9 digits long. It should not have any alphabets between the digits however space is allowed
for example
ABCD 123456789 -> 123456789
123M4567 -> blank
1234567890 ABCD -> 1234567890
123 456 789 ABCD -> 123456789 or 123 456 789 will also be fine
try this...
/(\d{9,})|([\d\s]{11,})/
This question already has answers here:
How to find a cycle/repeats in a string?
(2 answers)
Closed 10 years ago.
This is what I am trying to solve.
I have a series of numbers like
1 -> 2
2 -> 3
3 -> 4
4 -> 2
2 -> 1
I need to write a program to prove if these numbers are points on a graph they form some kind of loop. In the above example 1 -> 2 -> 3 -> 4 -> 2 form a loop.
In the following example there is no loop.
1 -> 2
2 -> 3
3 -> 4
3 -> 5
Don't understand how this is a duplicate. Sorry if my question is not clear. I am trying my level best to describe it.
I have set of points/numbers/nodes. They are in pair and also they have direction.
For example pair of numbers are
1 -> 2
2 -> 3
1 -> 2
3 -> 4
4 -> 2
2 -> 1
3 -> 4
When these individual nodes are connected from top to bottom I will get linked lists as below
1 -> 2 -> 3 -> 1 -> 2 -> 3 -> 4 -> 2 -> 1 -> 3 -> 4
I am not looking for a repeated pattern in this set of numbers. trying to find closed loops like 1 -> 2 -> 3 -> 1 is a loop. 2 -> 3 -> 1 -> 2 is a loop. 3 -> 1 -> 2 -> 3, 2 -> 3 -> 4 -> 2, 3 -> 4 -> 2 -> 1 -> 3 etc.
in this wiki link there is one loop that is 1 _. 6 -> 3 -> 1 http://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Functional_graph.svg/240px-Functional_graph.svg.png
Hope this makes the question clear!
A very simple way could be adding the two numbers as a key,value pair in a Hashtable:
Once you are in a situation where the key already exists error is thrown or ContainsValue condition is true , you have found a cycle.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
In VB.NET, I can quickly type And/AndAlso on the keyboard. In C#, I'm currently opening Character Map and copying the 'OR' vertical line character manually. Am I missing something that allows quick insertion of the line symbol?
It is also called the pipe key, on many keyboards (UK/US) it is a single broken vertical line (one some keyboards it is a single unbroken vertical line, but I mostly see it as a broken one).
Image from here.
Depends on the keyboard layout, but the | / pipe should be somewhere on the left of the enter key (US layout), or on the left of Z or 1 (first normal, the other with AltGr, UK layout).
Wherever you have the PIPE key, you could type, on the numeric keypad and keeping the ALT key pressed, the number 124
I don't know where you are from, but assume that you have a non-english keyboard. Unfortunately the C language (where this and other syntactic elements) originates from was developed with the english standard keyboard in mind.
I know some people here in Sweden are switching to english keyboard layout when coding - to get rid of the awkward placement of key C/C# characters like | { [ ] } \. (They are all combinations that require the AltGr key. Something had to be done to make place for the Swedish characters ÅÄÖ that all have their own keys.)
I have the "pipe" symbol as altGr + 1