Mr. Mayers and the Exam - imagepicker

input1:5
input2:{1.4.5.4.5}
output: 23
here the question 1 would have atleat 1 mark,question 2 would have atleat 4 marks .question 3 would have atleast 5 marks,so the new set of marks will be{1,4,5,6,7},such that all conditions are satisfied
Mr. Myers and the Exam
A mathematics question paper has certain number of questions and each question is assigned some random maximum marks. Mr. Myers wants to edit the marks assigned to the questions such that:
All questions in the paper should have distinct maximum marks. 2. The total marks of all the questions should be as low as possible.
Mr. Myers wants to achieve this by making minimal changes in the original format, assigning the question at least as much marks as it originally had. Find the minimum total marks that he can set the paper for.
here the question 1 would have atleat 1 mark,question 2 would have atleat 4 marks .question 3 would have atleast 5 marks,so the new set of marks will be{1,4,5,6,7},such that all conditions are satisfied

Related

Minimum number if Common Items in 2 Dynamic Stacks

I have a verbal algorithm question, thus I have no code yet. The question is this: How can I possibly create an algorithm such that I have 2 dynamic stacks, both can or can not have duplicate items of strings, for example I have 3 breads, 4 lemons and 2 pens in the first stack, say s1, and I have 5 breads, 3 lemons and 5 pens in the second stack, say s2. I want to find the number of duplicates in each stack, and print out the minimum number of duplicates in both lists, for example:
bread --> 3
lemon --> 3
pen --> 2
How can I traverse 2 stacks and print the number of duplicated occurrences until the end of stacks? If you are confused about anything, I can edit my question depending on your confusion. Thanks.

Concatenate rows across multiple columns in Access 2013 using VBA

I've an Access database that follows each Line Item across multiple stages where tasks are assigned to individuals. Each stage has a Comments field and are recorded in a Table which looks like:
Line Item Stage Title Comments
1 1 Introduction Trial comment
1 1 Introduction Another one
1 2 Abstract Following one
1 2 Abstract Andi nexto
1 3 Thesis Nexto
2 1 Introduction Comment for next item
2 1 Introduction Andi another one
...
I want to be able to concatenate these comments for each stage and each Line Item as:
Line Item Stage Title Comments
1 1 Introduction Trial comment, Another one
1 2 Abstract Nexto one, Andi next
1 3 Thesis Nexto
2 1 Introduction Comment for nexto item, Andi another one
I tried using Allen Brown's ConcatRelated() function with multiple WHERE criteria:
ConcatRelated("[Comments]","[CommentsT]","[LineItemNo]=" & "[txtLineItemNo] AND "[StageNo]=" & [txtStageNo])
but with no luck. Using a single WHERE clause does concatenate all the comments in the required field without considering StageNo and Title.
Kindly advise as to what is the best way for me to achieve this.
Thank you.

Is It A Good Idea or A Huge Mistake to Combine More Than 1 Type of Data Into A Single Column in An SQL Database Table? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
So, let's say I have 5 items, A, B, C, D and E. Item A comes in sizes 1 and 2, item B comes in sizes 2 and 3, C comes in 1 and 3, D comes in 1 and E comes in 3. Now, I am considering 2 table options, as follow:
Table 1
Name
Size
A
1
A
2
B
2
B
3
C
1
C
3
D
1
E
3
Another option is Table 2, as follows:
Name
A1
A2
B2
B3
C1
C3
D1
E3
Now, which of these 2 tables is actually a better option? What are the advantages and disadvantages (if any) of each of the 2 tables above? One thing that I can think of is that, if I use table 1, I can easily extract all items by size, no matter what item I want. So, for instance, if I want to analyze this month's sales of items of size 1, it's easy to do it with Table 1. I can't seem to see the same advantage if I use table 2. What do you guys think? Please kindly enlighten me on this matter. Thank you in advance for your kind assistance, everyone. Cheers! :)
I don't even understand why you have the second table option - what purpose does it have or how does it help you? Plain and simple you have a one to many relationship. That is an item comes in 1 or more different sizes. You just saying that sentence should scream ONLY option 1. Option 2 will make your life a living hell because you are going against normalization guidelines by taking 2 datatypes into 1, and it has no real benefit.
Option 1 says I have an item and it can have one or more sizes associated with it.
Item Size
A 1
A 2
A 3
B 1
C 1
C 2
Then you can do simple queries like give me all items that have more then 1 size. Give me any item that only has 1 size. Give me all the sizes of item with item id A, etc.

Karnaugh map group sizes

Full disclosure, this is for an assignment I don't think I'm looking for spoon feeding, more so just a general question. Am a I allowed to break that into a group of 8 and 2 groups of 4, or do all group sizes have to be equal, ie 4 groups of 4
1 0 1 1
0 0 0 0
1 1 1 1
1 1 1 1
Sorry if this is obvious, but my searches haven't been explicit and my teacher was quite vague. Thanks!
TL;DR: Groups don't have to be equal in size.
Let see what happens if, in your case, you take 11 groups of one. Then you will have an equation of eleven terms. (ie. case_1 or case_2 or... case_11).
By making big group, in your case 1 group of 8 and 2 groups of 4, you will have a very short and simplified equation like: case_group_8 or case_group_4_1 or case_group_4_2.
Both grouping are correct (we took all the one in the map) but the second is the most optimized. (i.e. you cannot simplified more)
Making 4 groups of 4 will bring you an equation that can be simplified more.
The best way now is for you to try both grouping (all 4 vs 8/4/4) and see the output result.

Determinant Finite Automata (JFLAP)

I have a DFA question (Determinant Finite Automata) . We are using JFLAP to construct the automata. I cannot figure this question out to save my life! Here it is
"DFA to recognize the language of all strings that have an even number of zeros and an odd number of ones."
So the alphabet is {0,1} and only using 0,1. So I need to build an automata that recognizes an even number of zeros and an odd number of ones.

			
				
I don't know whether my understanding is right.
I could give you the description in Grail format that generate an even number of zeros and an odd number of ones.
START 1
1 1 2
2 1 1
1 0 3
3 0 4
4 0 3
FINAL 3