What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-18 09:57:08
longest increasing subsequence techie delight
#include <iostream> #include <vector> using namespace std; // Iterative function to find longest increasing subsequence // of given array void findLIS(int arr[], int n) { // LIS[i] stores the longest increasing s... Add solution -
Java 2021-11-16 20:12:12
java print each line of a list
//To print each item in a list we use the print line function //First we need a list, i will be using an array list to start String[] animals = {"dog", "cat", "elephant", "moose"}; //Next we need a way to go trhoug... Add solution -
Java 2021-11-15 23:16:17
how to get index of second occurrence java
String str = "itiswhatitis"; //returns the index of the first i in "is" str.indexOf("is"); //returns the index of the second occurence of i in "is" after the first str.indexOf("is", str.indexOf("is&... Add solution -
Python 2021-11-15 09:13:23
python find string in list
# Example usage: your_list = ['The answer to', 'the ultimate question', 'of life', 'the universe', 'and everything', 'is 42'] [idx for idx, elem in enumerate(your_list) if 'universe' in elem][0] --> 3 # The 0-based index of the first list elemen... Add solution -
Python 2021-11-15 04:43:10
lastindexof python
# using rindex() test_string = "abcabcabc" # using rindex() # to get last element occurrence res = test_string.rindex('c') # printing result print ("The index of last element occurrence: " + str(res)) OUTPUT: The index of last... Add solution -
Javascript 2021-11-14 23:43:14
javascripr array.map
const myArray = ['Sam', 'Alice', 'Nick', 'Matt']; // Appends text to each element of the array const newArray = myArray.map(name => { return 'My name is ' + name; }); console.log(newArray); // ['My name is Sam', 'My Name is Alice', ...] // Appends ... Add solution