Input the following code inside your terminal:

npx create-react-app my-app

Congratulations you are done! the whole project has started! (It was a joke, but that has typically been the first command I enter to start a react project.) But let’s get serious. React is a wide JavaScript library, used by…

Given a string of words, reverse all the words. For example:

“Hi my name is Avi”, becomes “Avi is name my Hi”.

def rev_word3(s):

words = []
length = len(s)
spaces = [' ']
i = 0
while i < length:
if s[i] not in spaces:
word_start = i

while i < length and s[i] not in spaces:
i += 1
i += 1
return " ".join(reversed(words))

The code above makes an empty array of words, finds the length of the input, an array with a space and an index start point. The code checks for the index being shorter than the length of the input in the first loop. The second loop checks for the final letter index of the word, then it returns the words reversed.

Given an array of integers (positive and negative) find the largest continuous sum. An example of an array would be the following: [7,2,-6,3,4,10,10,-10,-10] . The array’s maximum sum would be 30, summing everything until the last two -10’s are not included in the sum.

def large_cont_sum(arr): 

if len(arr)==0:
return 0

max_sum = current_sum = arr[0]

for num in arr[1:]:
current_sum = max(current_sum + num, num)
max_sum = max(current_sum, max_sum)
return max_sum

Consider an array of non-negative integers. A second array is formed by shuffling the elements of the first array and deleting a random element. Given the two arrays, find which element is missing in the second array.

def findt_missing(arr1,arr2):

for num1, num2 in zip(arr1,arr2):
if num1 != num2:
return num1
return arry1[-1]

The zip() function returns a zip object, which is an iterator of tuples where the first item in each passed iterator is paired together, and then the second item in each passed iterator are paired together etc.

If the passed iterators have different lengths, the iterator with the least items decides the length of the new iterator.

a = ("John", "Charles", "Mike")
b = ("Jenny", "Christy", "Monica")
x = zip(a, b)
(('John', 'Jenny'), ('Charles', 'Christy'), ('Mike', 'Monica'))

The bigO notation for the solution of our problem is nLog(n).

They’re many ways to approach this problem, but you have to consider the time it takes to run the code once the data becomes much bigger than your sample test data.

The Array Pair Sum problem: Given an integer array, output all the unique pairs that sum up to a specific value C.

def pair_sum(arr, C):
if len(arr)<2:
seen = set()
output = set()
for num in arr:
target = C - num
if target not in seen:
output.add((min(num,target), max(num,target)))
print ('\n'.join(map(str,list(output))))

This code has a big O notation of n which is exponential due to having to do two loops. Remember that spaces matter when coding with python!

Application programming interface or API, is a software intermediary that allows for two applications to talk to each other. In other words, an API is the messenger that delivers your request and responses from the front end to the back end of your program (client side rendering).

API’s are designed…

Devise gem is a beautiful gem. Inside your gemfile, require:

gem 'devise', '~> 4.7', '>= 4.7.1'

Or which ever version is the most updated. Run bundle install to grab the library and any dependencies for your rails project.Next, you need to run the generator:

rails generate devise:install

Open the devise.rb

Avitosh Totaram

Problem solver with experience in Software, and Mechanical engineering. Interested in web-dev, machine learning, artificial intelligence, and new technologies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store