answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Jlenok [28]
2 years ago
7

A pincode consists of N integers between 1 and 9. In a valid pincode, no integer is allowed to repeat consecutively. Ex: The seq

uence 1, 2,1, 3 is valid because even though 1 occurs twice, it is not consecutive. However, the sequence 1, 2, 2, 1 is invalid because 2 occurs twice, consecutively. Utilize a for loop and branch statements to write a function called pinCodeCheck to detect and eliminate all the consecutive repetitions in the row array pinCode. The function outputs should be two row arrays. The row array repPos contains the positions pinCode where the consecutive repeats occurs, and the row array pinCodeFix is a valid pincode with all the consecutive repeats removed in pinCode. Hint: The empty array operator [] is will be helpful to use.
Computers and Technology
1 answer:
ohaa [14]2 years ago
5 0

Answer:

function [ repPos, pinCodeFix ] = pinCodeCheck( pinCode )

       pinCodeFixTemp = pinCode;

       repPosTemp = [];

   for i = 1:length(pinCode)

       if((i > 1)) & (pinCode(i) == pinCode(i - 1))

           repPosTemp([i]) = i;

       else

           repPosTemp([i]) = 0;

       end

   end

   for i = 1:length(pinCode)

       if(repPosTemp(i) > 0)

           pinCodeFixTemp(i) = 0;

       end

   end

   repPosTemp = nonzeros(repPosTemp);

   pinCodeFixTemp = nonzeros(pinCodeFixTemp);

   repPos = repPosTemp';

   pinCodeFix = pinCodeFixTemp';

   

end

Explanation:

Let me start off by saying this isn't the most efficient way to do this, but it will work.

Temporary variables are created to hold the values of the return arrays.

       pinCodeFixTemp = pinCode;

       repPosTemp = [];

A for loop iterates through the length of the pinCode array

       for i = 1:length(pinCode)

The if statement checks first to see if the index is greater than 1 to prevent the array from going out of scope and causing an error, then it also checks if the value in the pinCode array is equal to the value before it, if so, the index is stored in the temporary repPos.

        if((i > 1)) & (pinCode(i) == pinCode(i - 1))

        repPosTemp([i]) = i;

Otherwise, the index will be zero.

         else

         repPosTemp([i]) = 0;

Then another for loop is created to check the values of the temporary repPos to see if there are any repeating values, if so, those indexes will be set to zero.

         for i = 1:length(pinCode)

         if(repPosTemp(i) > 0)

         pinCodeFixTemp(i) = 0;

Last, the zeros are removed from both temporary arrays by using the nonzeros function. This causes the row array to become a column array and the final answer is the temporary values transposed.

         repPosTemp = nonzeros(repPosTemp);

         pinCodeFixTemp = nonzeros(pinCodeFixTemp);

         repPos = repPosTemp';

         pinCodeFix = pinCodeFixTemp';

You might be interested in
Splunk uses ________ to categorize the type of data being indexed..
timama [110]
<span>Splunk is the system process that handles indexing, searching, forwarding and the web interface for Splunk Enterprise.</span>
Splunk uses sourcetypes to categorize the type of data being indexed.
Splunk supports the Common Information Model (CIM). 
7 0
2 years ago
Read 2 more answers
+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~
Karo-lina-s [1.5K]

+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.

<em><u>please</u></em><em><u> </u></em><em><u>mark</u></em><em><u> </u></em><em><u>me</u></em><em><u> </u></em><em><u>as</u></em><em><u> </u></em><em><u>brainliest</u></em><em><u>. </u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

<em><u>follow</u></em><em><u> </u></em><em><u>me</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>my</u></em><em><u> </u></em><em><u>fr</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

6 0
2 years ago
Write a method called justFirstAndLast that takes a single String name and returns a new String that is only the first and last
NemiM [27]

Answer:

Answer is in the attached screenshot.

Explanation:

Using regex to split a given input string via whitespace, then returns the first and last element of the array.

6 0
2 years ago
Choose the correct sequence for classifier building from the following.
Alekssandra [29.7K]

Answer:

b

Explanation:

First, we need to initialize the classifier.

Then, we are required to train the classifier.

The next step is to predict the target.

And finally, we need to evaluate the classifier model.

You will find different algorithms for solving the classification problem. Some of them are like  decision tree classification  etc.

However, you need to know how these classifier works.  And its explained before:

You need  to initialize the classifier at first.

All kinds of classifiers in the scikit-learn make use of the method fit(x,y) for fitting the model or the training for the given training set in level y.

The predict(x) returns the y which is the predicted label.And this is prediction.

For evaluating the classifier model- the score(x,y) gives back the certain score for a mentioned test data x as well as the test label y.

8 0
2 years ago
After experiencing several issues with an Active Directory domain controller, you have decided to perform a restore operation on
Vikentia [17]

Normally active directory once is corrupted best method is to repair the active directory. As IT administrator user has keep a proper backup either date wise or weekly wise.

<u>Explanation:</u>

If IT administrator doesn’t have enough backup restore or repairing the active directory is highly impossible.

Before restore proper information to be made and rebooted the domino server and selected advance boot option and select the restore options. And select the proper and good backup and restore it. After restoring the backup domain server started and domain active directory should work proper.

As experience better to reinstall domain server and active directory is good practice.

5 0
2 years ago
Other questions:
  • Name and summarize the four levels of administration necessary to keep human services organization operating smoothly
    9·2 answers
  • 14. If B3=10 and D5=8, what would the following function return? IF(B3&gt;D5, "Closed", D5-B3) *
    9·1 answer
  • Match the following technologies with their applications.
    9·1 answer
  • 1.2.2: Output variable value. Jump to level 1 Write a statement that outputs variable userAge. End with a newline. 1 2 3 4 5 6 7
    12·1 answer
  • What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
    12·1 answer
  • Define a function UpdateTimeWindow() with parameters timeStart, timeEnd, and offsetAmount. Each parameter is of type int. The fu
    13·1 answer
  • Define the instance method inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for th
    10·1 answer
  • Which OS function does a CLI fulfill? A User interface B Running applications C Hardware interface D Booting
    8·1 answer
  • Choose the reasons why Windows Server operating systems are a popular choice for a network because they _____. Select all that a
    12·1 answer
  • What are ways to enter a formula in Excel? Check all that apply. Click on the Function Library group and select a function from
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!