return trailing set of nums from string python
By : Jak
Date : March 29 2020, 07:55 AM
this one helps. How can I return the trailing set of numbers from a list of strings? , You can use regex: code :
>>> import re
>>> r = re.compile(r'\d+$')
>>> [int(m.group()) for m in (r.search(item) for item in mylist) if m]
[2, 20, 244, 288888]

push and popping ruby arrays nums << (nums.pop) + (nums.pop)
By : Rendy Widi Lestari
Date : March 29 2020, 07:55 AM
it helps some times pop cuts off the last element form an array and returns it. << is the same as push  adds one element to the end of the array. code :
[1,2,3] > pop=3,pop=2,add=(2+3),push=5 > [1,5]
[1,5] > pop=5,pop=1,multiply=(1*5),push=5 > [5]

How to return the most right positive nums array cut?
By : Jesus Federico
Date : March 29 2020, 07:55 AM
I hope this helps . My task: The input is a onedimensional array. It is necessary to find the range of maximum width, the elements of which are positive (greater than 0). As a response, there should be an array of 2 elements, where:  Element number 0  the index element of the left border of the segment;  Element №1  the index of the element of the right border of the segment. , I see two issues: code :
if (currentSequenceLength >= sequenceLength) {
sequenceLength = currentSequenceLength;
result[0] = firstIndex;
result[1] = lastIndex;
}
public static int[] lookFor(int[] array) {
int[] result = new int[2];
int firstIndex = 0;
int lastIndex = 0;
int sequenceLength = 0;
int currentSequenceLength = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] > 0) {
if ( currentSequenceLength == 0 ) {
firstIndex = i;
}
currentSequenceLength += 1;
lastIndex = i;
} else {
if (currentSequenceLength >= sequenceLength) {
sequenceLength = currentSequenceLength;
result[0] = firstIndex;
result[1] = lastIndex;
}
currentSequenceLength = 0;
}
}
if (currentSequenceLength >= sequenceLength) {
sequenceLength = currentSequenceLength;
result[0] = firstIndex;
result[1] = lastIndex;
}
if (sequenceLength == 0) {
return new int[0];
}
return result;
}

`nums[nums.length  1]; ` is an range or single element?
By : Tom
Date : March 29 2020, 07:55 AM
this one helps. It is a single element, because num.lengh  1 is an int and just gives you the last accessible index of the array. If you check wether the length of the array is > 0, then you can safely use the length of the array to determine the last accessible index. code :
for (int j = 0; j < nums.length; j++)
for (int j = 0; j <= nums.length  1; j++)
for (int j = 0; j <= nums.length; j++)

Difference between nums[:] = nums[::1] and nums = nums[::1]
By : adarsh sharma
Date : October 07 2020, 04:00 PM
help you fix your problem If you know about C and pointers, you can picture nums as a pointer to a list. Consider this case: code :
def reverse(nums):
nums = nums[::1]
my_list = [1, 2, 3]
reverse(my_list)
def reverse(nums):
nums[:] = nums[::1]
my_list = [1, 2, 3]
reverse(my_list)

