1624435380

# LeetCode Algorithm Challenge: Plus One - I Wish It Could Be That Simple

## Question

Given a non-empty array of decimal digits representing non-negative integers, increment the final integer by 1.

The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit.

You may assume the integer does not contain any leading zero, except the number 0 itself.

Example 1:

``````Input: digits = [1,2,3]
Output: [1,2,4]
Explanation: The array represents the integer 123.
``````

Example 2:

``````Input: digits = [4,3,2,1]
Output: [4,3,2,2]
Explanation: The array represents the integer 4321.
``````

Example 3:

``````Input: digits = [0]
Output: [1]
``````

#programming #javascript #algorithms #leetcode

1624435380

## Question

Given a non-empty array of decimal digits representing non-negative integers, increment the final integer by 1.

The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit.

You may assume the integer does not contain any leading zero, except the number 0 itself.

Example 1:

``````Input: digits = [1,2,3]
Output: [1,2,4]
Explanation: The array represents the integer 123.
``````

Example 2:

``````Input: digits = [4,3,2,1]
Output: [4,3,2,2]
Explanation: The array represents the integer 4321.
``````

Example 3:

``````Input: digits = [0]
Output: [1]
``````

#programming #javascript #algorithms #leetcode

1624874940

## Leetcodes Algorithm Series: Contains Duplicate

Hello, hello! As I continue my job search, I am practicing my algorithm questions on Leetcode. So, I thought I would blog about some Leetcode problems as I solve them.

As a Bootcamp graduate, I did not get much practice in algorithms, so it has been a very fun and sometimes frustrating trial and error in recognizing patterns, optimizing my code to be faster (looking at you Big-O), learning how to break down a problem, and sometimes implementing neat math tricks to solve these algorithm problems. I have been practicing them using JavaScript.

As I’m relatively new to algorithm problems, I’ve started out with their Easy Collection of Top Interview Questions. So in Contains Duplicate:

Given an integer array `nums`, return `true` if any value appears at least twice in the array, and return `false` if every element is distinct.

Examples:

``````Input: nums = [1,2,3,1]
Output: true

Input: nums = [1,2,3,4]
Output: false
Input: nums = [1,1,1,3,3,4,3,2,4,2]
Output: true
``````

Simply, if any numbers in the array appear more than once in the array, I need to return `true` . Now, I will definitely need to figure out a way to compare a number to the other numbers. Additionally, I will most likely need to loop through the array so I have access to each number to then compare it to others.

First, I thought that I could iterate through the array, and at each instance, I iterate through another loop of the remaining integers and compare them to see if any are equal (===). However, per my beginner understanding of Big-O, this would yield me an unfavorable time complexity of O(n²).

Then, I thought that I could create an object and count how many times a number in the array appears. By doing this, I could then check to see if any of the numbers had a count greater than 1. If so, then I could return `true` else I would return `false` .

#computer-science #leetcode #javascript #programming #algorithms #leetcodes algorithm

1627023547

Vigrx Plus ( natural viagra ) is a nutritional supplement and male sexual performance enhancer, made from natural ingredients and with a unique formula on the market to treat erectile dysfunction. Because it is an organic product, it does not require a prescription, it is easy to take and has studies that have endorsed its effectiveness for years, as well as testimonials from thousands of satisfied customers. Before making an informed decision to buy Vigrx Plus, learn below about its ingredients, price, mode of administration, contraindications, how it differs from traditional medications, how to buy it, and much more.

Vigrx Plus opinions

About Vigrx Plus : Vigrx Plus is a nutritional supplement, used to improve male sexual performance and as a natural treatment alternative for male sexual dysfunction, especially erectile dysfunction.

What is?
Vigrx Plus is a nutritional supplement made from 100% natural ingredients, which is used as a sexual performance enhancer in adult men. It has various positive effects such as creating improvements in achieving and maintaining an erection in patients with erectile dysfunction, increasing stamina and energy during sexual activity, increasing libido and sexual appetite, and even increasing the size of the penis by 1 to 6 centimeters during erection while the supplement is being treated.

Its complete formula of organic compounds used for years in ancestral medicine gives it a safety and efficacy profile that is not easily achieved in the market. In addition, it has been endorsed by clinical studies published on its official website that attest to its good results.

Mode of administration : The manufacturer’s recommended dose to take Vigrx Plus is one to two supplements, orally with a glass of water, divided into two main meals of the day. Usually, it has been suggested to take either one capsule 20 minutes before breakfast, and / or one capsule 20 minutes before dinner.

Available presentation : Vigrx Plus comes in a box presentation with 60 tablets, intended to cover one month of continuous treatment.

Price per tablet : Vigrx Plus can be purchased directly on the website of its manufacturers, and they often offer incredible deals and packages for several months of treatment for a price per tablet that can vary.

The price per tablet of Vigrx Plus online is € 1.10, in bottles containing 60 capsules. The bottle of 60 capsules of Vigrx Plus cheap is priced at € 65.95 on its official website.

Onset of action : It is recommended to take Vigrx Plus for 30 to 60 days to begin to see satisfactory results (its manufacturers even recommend trying it for 3 months), but there are men who have reported positive effects with less than 30 days of treatment.

Duration of action : The positive effects of Vigrx Plus may be noticeable throughout the duration of treatment with the supplement.

Alteration with meals : No interaction between food intake and consumption of Vigrx Plus has been reported. Even the way to take Vigrx Plus that is highly recommended is one tablet 20 minutes before a main meal.

Side Effects : Vigrx Plus is a natural supplement with a carefully balanced formula that has been perfected for years; therefore, in itself it has no reports of side effects with its shots. However, some of its ingredients alone can produce certain mild adverse effects such as nausea, palpitations, agitation and allergic reactions to the components.

How does Vigrx Plus work?
Vigrx Plus has several natural ingredients, which together perform various functions. To better understand how it gives rise to its effects in the male body, we must briefly talk about each of its eleven main ingredients, and their benefits on sexual performance:

Asian red ginseng (200 mg) : this extract has been used for centuries in ancient medicine for its aphrodisiac powers; in addition to increasing nitric oxide and blood flow throughout the body and thus, energy and general vitality. source

Saw Palmeto berries (200 mg) : these fruits increase the production of testosterone (the male sex hormone), and with it, virility and the ability to maintain an erection.

Hawthorne berries (200 mg) : these fruits have powerful antioxidant and vasodilator effects, increasing blood flow to the penis.

Gingko Biloba (200 mg) : Gingko Biloba is present in most sexual performance enhancement supplements, and this is not a coincidence. Its antioxidant effects optimize the overall health of the body; particularly, increased blood flow to the penis represents the definitive step to a satisfactory erection. source

Damiana (200mg) - These leaves have also been used for years by various cultures as an aphrodisiac, erectile dysfunction treatment, and sexual invigoration. source

Tribulus Terrestris (150 mg) : increases testosterone production, sexual desire and erections. source

Catuaba (100 mg) : increase libido and sexual desire since time immemorial. source

Muira Pauma extract (100 mg) : increases sexual appetite, which has been proven in different studies. It is called the “root of the erection.” source

Dodder extract (50 mg) : increases blood flow to the penis, improving the ability to get an erection. source

Epimedium extract (30 mg) : also called “horny goat weed” is potent in increasing libido, increasing the production of male sex hormone (testosterone), restoring erectile function, and improving stamina and energy during sexual intercourse. . source

Bioperine (10mg) - This Indian black pepper extract is what sets Vigrx Plus apart from the competition and from its predecessor, Vigrx. This compound is vital when it comes to helping in the absorption of the rest of the ingredients, increasing it by up to 35%. Basically, Bioperine ensures that the nutrients in the supplement are safely absorbed.

Vigrx Plus opinions

Why switch to Vigrx Plus?
Sometimes the treatment for erectile dysfunction with traditional drugs is not so easy to perform for patients with contraindications or fear of submitting to synthetic chemicals. The biggest advantage of Vigrx Plus is that it is made up of natural ingredients, which eliminates the adverse effects and many other drawbacks that can occur with preservative pills.

In addition to this, Vigrx Plus has more comprehensive effects on health in general, since it is not only limited to improving sexual performance (although this is its greatest advantage), but it increases the energy, stamina and virility of men than the take, in all aspects of your life.

Vigrx Plus has years of experience and a special addition to the original formula called Bioperine, which guarantees the absorption of all nutrients safely and proven by clinical studies.

A great advantage that it has is that the manufacturers of Vigrx Plus are so confident in their product that they offer a 67-day guarantee with full money back if the patient does not see the expected results with the supplement; but the testimonials and the level of satisfaction of the reviews allude to him great efficacy and safety of use.

promo code vigrx plus

Instructions for use and dosage of the Vigrx Plus supplement:
The recommended dose of taking Vigrx Plus is one to two capsules a day: one capsule 20 minutes before breakfast, and one 20 minutes before dinner. In total, one to two tablets a day is suggested, for at least 30 to 60 days to have satisfactory results; but the most noticeable results occur in people who take it continuously for 6 months.

Is it effective every time?
Every body reacts differently to whatever treatment it is subjected to. When it comes to erectile dysfunction, no measure is out of the question, and the use of herbal supplements like Vigrx Plus has increased over time for good reason - it offers all the benefits, with minimal risks.

Although it is not possible to speak of definitive results in all cases, there are public testimonials and thousands of satisfied customers around the world who guarantee that the efficacy and safety of Vigrx Plus are worth even trying, as there is little to lose. Its operation is reliable, fast and simple.

test vigrx plus

Possible undesirable effects of Vigrx Plus:
No serious adverse events have been formally reported with taking Vigrx Plus, especially since it is a supplement made up of natural ingredients. However, some of its ingredients could cause certain side effects such as palpitations, nausea, agitation, mild fever or allergic reactions.

Contraindications: Cases in which Vigrx Plus should not be taken
The manufacturer has not listed formal contraindications for the intake of Vigrx Plus. However, there are certain conditions in which medical advice should be sought before considering taking the supplement, such as in the case of underlying heart diseases in which sexual intercourse is contraindicated (heart failure, recent myocardial infarction, angina pectoris). ; The risk-benefit should also be evaluated by a health professional in the case of receiving treatment for schizophrenia, Alzheimer’s, and other neurological diseases.

Vigrx Plus should not be taken by patients under 18 years of age.

vigrx plus cheap

Interactions of the drug Vigrx Plus with other substances
Vigrx Plus interactions with other substances have not been reported. However, patients receiving medications for cardiac or neurological pathologies should consult their doctor before considering starting treatment with this supplement.

Vigrx Plus should not be taken at the same time as other erectile dysfunction treatments without doctor’s authorization.

opinion vigrx plus

Fertility, pregnancy and lactation
Vigrx Plus is not indicated for treatment in women, therefore data are limited.

There have been no evidence of changes in fertility in men taking Vigrx Plus.

Vigrx Plus opinions

Overdose
No cases of overdose have been reported with Vigrx Plus. However, only the recommended dose of the product should be taken with caution.

vigrx plus price

Why should patients consult their doctor before taking erectile dysfunction treatment for the first time?

Even natural supplements, such as Vigrx Plus, have special warnings for use, as well as a particular mode of administration and certain risks with their taking. For this reason, it is always advisable to attend the doctor before starting treatment with this or any other drug for erectile dysfunction.

What is the difference between Vigrx Plus and Viagra?

Cheap Vigrx Plus is a nutritional supplement to improve sexual performance made from 100% natural ingredients, while Viagra is a phosphodiesterase 5 inhibitor, part of the group of traditional drugs used for erectile dysfunction.
Viagra can be found in pharmacies and online; Vigrx Plus should only be purchased through the official product page to ensure you receive the real product.
Vigrx Plus has no formal contraindications or major interactions; Viagra has a long list of warnings and risks with its use.
Viagra only works under sexual stimulation, while Vigrx Plus has among its advantages even increasing the appetite or sexual desire.
Is Vigrx Plus stronger than Viagra?

Because they are completely different drugs, it cannot be said that one is more powerful than the other. However, for a natural supplement, Vigrx Plus does have many more features and benefits that Viagra does not cover.

What is the recommended dose to start taking Vigrx Plus?

The suggested dose to take Vigrx Plus is one to two tablets a day, 20 minutes before main meals such as breakfast or dinner.

How long does Vigrx Plus last, and how often can I take it?

The effects of Vigrx Plus may be present while the supplement is being taken, as long as the correct treatment regimen has been followed and 30 to 60 days of continuous intake have passed.

It is not recommended to take more than two capsules a day.

Can I drink alcohol if I am taking Vigrx Plus?

Yes, you can safely drink alcohol while taking Vigrx Plus.

Can I take Vigrx Plus with other medicines?

You should not take Vigrx Plus with other erectile dysfunction medications.

If you are taking medication for any heart or neurological condition, consult your doctor before taking Vigrx Plus.

Can Vigrx Plus cause unwanted erections?

Vigrx Plus increases libido and improves the ability to achieve and maintain an erection, but does not produce spontaneous or unwanted erections.

Do I need a prescription to buy Vigrx Plus or can I get it without it?

You do not need a prescription to buy Vigrx Plus.

Is Vigrx Plus less expensive online than in the pharmacy?

Cheap Vigrx Plus can be obtained easily and without a prescription through the official website of the manufacturer.

What should I do if Vigrx Plus does not work for me or becomes ineffective over time?

You should not take more than the indicated daily dose of Vigrx Plus. You can return the product to the official website of the manufacturer, as they offer a money-back guarantee if you are not satisfied with the results before 60 days of treatment.

References:

Gaurang, R., Manojkumar, C., Suresh, B., Shrikant, P., Vilas, P., Navneet, A. (2012). Evaluation of a multi-herb supplement for erectile dysfunction: a randomized double blind, placebo-controlled studio. BMC complementary and alternative medicine. 12 (155).

Disclaimer : The information available on the nutritiousthink.com website does not substitute in any way for the consultation of competent health professionals. It is the responsibility of the Internet user to consult a health professional.

#vigrx plus #vigrx plus reviews #vigrx plus walmart #vigrx plus review #vigrx plus prices #vigrx plus official website

1596429120

# What is a Palindrome?

A palindrome is a word that reads the same forwards and backwards. In my universe, there are two kinds of palindrome: “Odd Pal” and “Even Pal”.

## Even Pal

Even Pal is a palindrome which has an even length, for example: “ZYXXYZ”. In the visualization below you can see how we can split it into 2 parts that have size 3: “ZYX” and “XYZ” . This palindrome will always have two centres called Left Center” at index2 and “Right Center” at index3.

“Even Pal”

Notice that:

• character at index2 = character at index3 (mirror 1)
• character at index1 = character at index4 (mirror 2)
• character at index0 = character at index5 (mirror 3)

It is because of the above equality of characters at their respective indexes that the string is a palindrome and the two parts look like a sequence of 3 mirrors.

## Odd Pal

Odd Pal is a palindrome which has an odd length, example: “ZYXWXYZ”. In the visualization below you can see how we can split the string into 2 parts that have size 3: “ZYX” and “XYZ”, while “W” at index3 becomes the center.

“Odd Pal”

Notice that:

• character at index2 = character at index4 (mirror 1)
• character at index1 = character at index5 (mirror 2)
• character at index0 = character at index6 (mirror 3)

Notice how again the two parts look like a sequence of 3 mirrors.

# Problem

The problem states that we have to find the longest substring that is a palindrome in the string. A substring is a section of a string that consists of contiguous elements. Some examples are:

Input1: “BABAD” | Output1: “BAB” or “ABA”

Input2: “CBBD” | Output2: “BB”

Input3: “A” | Output3: “A”

# Solutions

## O(n²) Complexity

The simplest way to solve for this is to take every index as 1) a center 2) a Left Center and expand outwards to make character comparisons and find mirrors. The sequence with the maximum number of mirrors would be returned. Seems very simple and intuitive but the complexity is O(n²) because expanding a palindrome around a center could take O(n) time and we will explore every index in the string to be a center and left center, so O(n²) would be the time complexity.

## O(n) Complexity

We can improve this runtime if we think of a way where we can leverage the previous palindromes found (as we navigate through the string) and reduce the “expanding outwards” part. Luckily, this is possible with “Manachar’s algorithm”.

# Manachar’s algorithm

Before diving into the algorithm itself, we need to learn a few things first. For simplicity we will be focusing on Odd Pals for the most part. So let’s learn a few things in order:

#palindrome #leetcode #algorithms #substring #coding #algorithms

1593347004

## A greedy algorithm is a simple

The Greedy Method is an approach for solving certain types of optimization problems. The greedy algorithm chooses the optimum result at each stage. While this works the majority of the times, there are numerous examples where the greedy approach is not the correct approach. For example, let’s say that you’re taking the greedy algorithm approach to earning money at a certain point in your life. You graduate high school and have two options:

#computer-science #algorithms #developer #programming #greedy-algorithms #algorithms