Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
So, say you have 2 sets with unknown properties. So the order and the size of each set is unknown. How would we merge and sort these 2 sets into one set?
The solution I have is to simply add the 2 sets into one set and perform a merge sort.
I feel as if there is a better way. Does anyone have any ideas?
Typically you would concatenate the sets and then sort them as a single set, that is almost as simple as it gets. I'm guessing you are using Python for this if that's the case you can use function sorted().
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
lets suppose
al=['Al','2l','3l','4l','5l','6l','7l','8l','9l','jl','ql','kl']
af=['Af','2f','3f','4f','5f','6f','7f','8f','9f','jf','qf','kf']
ak=['Ak','2k','3k','4k','5k','6k','7k','8k','9k','jk','qk','kk']
an=['An','2n','3n','4n','5n','6n','7n','8n','9n','jn','qn','kn']
are array
let's suppose
there a two-person wait for random numbers to get
but they should not get the same word ( 3 outputs should be to 2 people from 4 arrays without repeating
)
Use Array#sample and then Enumerable#each_slice:
persons, cards = 2, 3
(al + af + ak + an).sample(persons * cards).each_slice(cards).to_a
#⇒ [["qk", "4l", "Ak"], ["6l", "8l", "5l"]]
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 4 years ago.
Improve this question
At the beginning, generating a 4x4 grid like the first grid
Notice that all numbers are less than 6.
Player can add more than 2 numbers together to get number 10 (those numbers must be neighbours of each other)
if the number is greater than 10, it only can be add up with itself, like 10+10=20, 20+20=40...160+160=320
How can I determine that the adding all the numbers does not sum up to 10, shown as the 2nd grid (even the 6+4=10 but they are not neighbor)?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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
Closed 9 years ago.
Improve this question
I have a matrix that is 300x50 big filled with integers. I want to find what number appears the most in that 300x50 matrix and have it returned as an integer.
Just use mode on the linearized matrix:
mode(matrix(:))
Example:
>> matrix = [3 2 3; 2 2 1]
matrix =
3 2 3
2 2 1
>> mode(matrix(:))
ans =
2
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
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
Improve this question
say i have 7 groups of 2 columns (14 columns in total) & many rows like "ab" "cd" "ef" ect... but i want to lock one the cells in that column say "a1" has a value then "b1" should be lock or if "b1" has a value then "a1" should be lock automatic like the otherones "cd" "ef" ... But not to change any other cells only the ones in their group ab cd ef ect..
more exp:: if c20 have a value or number then d20 should be lock
my sheet is base on profit or lose so i dont want 1 profit or 1 lose to be entered in the same group "ab" "cd" "ef"
You can prevent data entry with Data Validation (offered as an alternative to locking cells) and a Custom formula such as =B1="" in A1 and =A1="" in B1. For each such pair only the first entered value will be accepted.