This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import math | |
# Auto-generated code below aims at helping you parse | |
# the standard input according to the problem statement. | |
n = int(input()) # Number of elements which make up the association table. | |
q = int(input()) # Number Q of file names to be analyzed. | |
emlist = {} | |
for i in range(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s1 = "abcd" | |
s2 = "abdc" | |
function isChild(str1, str2) { | |
let result = [] | |
let count = 0 | |
for (let i = 0; i < str1.length; i++) { | |
if (str1[i] === str2[count]) { | |
result.push(str2[count]) | |
count++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.7.0 <0.9.0; | |
contract Counter { | |
uint public count = 0; | |
// function getCount() public view returns(uint) { | |
// return count; | |
// } | |
function incrementCount() public { | |
count++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.7.0 <0.9.0; | |
contract MyContract { | |
uint[] public intArray = [1,2,3]; | |
string[] public stringArray = ["a","b", "c", "d"]; | |
string[] public values; | |
uint[][] public my2dArray = [ [1,2,3,4], [5,6,7,9] ]; | |
function pushValues(string memory _value) public { | |
values.push(_value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.7.0 <0.9.0; | |
contract Mapping { | |
mapping(uint => Book) public books; | |
//nested mapping | |
mapping(address => mapping(uint8 => Book)) public myBooks; | |
struct Book { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.7.0 <0.9.0; | |
contract Hotel { | |
enum Status { Vacant, Occupied } | |
Status currentStatus; | |
event Occupy(address _occupant, uint _value); | |
address payable public owner; | |
constructor() { | |
owner = payable(msg.sender); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string = "abcdefghijklmnopqrstuvwxyz" | |
function cipher(str, k) { | |
let first = [] | |
let second = [] | |
for (let i = k; i < str.length; i++) { | |
second.push(str[i]) | |
} | |
for (let i = 0; i < k; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = [44, 30, 24, 32, 35, 30, 40, 38, 15] #16 | |
arr2 = [10, 9, 8, 2] #-1 | |
arr3 = [10, 12, 4, 5, 9] #5 | |
arr4 = [14, 20, 4, 12, 5, 11] #8 | |
def possibility(array): | |
for i in range(0, len(array)): | |
try: | |
if (array[i] < array[i+1]): | |
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function StringChallenge(str) { | |
// code goes here | |
let result = "" | |
str = reversing(str) | |
for (let i = 0; i < str.length; i++) { | |
let current = str[i].charCodeAt(0) | |
if (current >= 65 && current <= 90) { | |
result = result + str[i].toLowerCase() | |
} else if (current >= 97 && current <= 122) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def countCharacters(string): | |
single = [] | |
whole = [] | |
result = "" | |
for i in string: | |
if (len(single) == 0): | |
single.append(i) | |
elif (i == single[0]): | |
single.append(i) | |
else: |
OlderNewer