This file contains hidden or 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 reverseList(head): | |
prev = None | |
current = head | |
while current: | |
next_node = current.next | |
current.next = prev | |
prev = current | |
current = next_node | |
return prev |
This file contains hidden or 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 removeDuplicates(nums): | |
if not nums: | |
return 0 | |
write_index = 1 | |
for i in range(1, len(nums)): | |
if nums[i] != nums[i - 1]: | |
nums[write_index] = nums[i] | |
write_index += 1 | |
return write_index |
This file contains hidden or 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 twoSum(nums, target): | |
for i in range(len(nums)): | |
for j in range(i + 1, len(nums)): | |
if nums[i] + nums[j] == target: | |
return [i, j] | |
return [] |
This file contains hidden or 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 time | |
class Node: | |
def __init__(self, data): | |
self.data = data | |
self.next = None | |
class LinkedList: | |
def __init__(self): | |
self.head = None |
This file contains hidden or 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
class Node: | |
def __init__(self, data): | |
self.data = data | |
self.next = None | |
class LinkedList: | |
def __init__(self): | |
self.head = None | |
self.tail = None |
This file contains hidden or 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
namespace _2_1 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int[,] matrix = new int[10, 10]; | |
Random rand = new Random(); | |
for (int i = 0; i < 10; i++) |
This file contains hidden or 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
namespace _2_0 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int[,] numbers = { { 4, 4 }, { 1, 1 } }; | |
int rows = numbers.GetUpperBound(0) + 1; | |
int columns = numbers.Length / rows; | |
int numProizv = 1; |
This file contains hidden or 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
namespace _1_10 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
const string HeroDefaultAttack = "1"; | |
const string HeroFireBall = "2"; | |
const string HeroExplodeAttack = "3"; | |
const string HeroHealthManaRegain = "4"; |
This file contains hidden or 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
namespace _1_1 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
const string CloseAp = "exit"; | |
Console.WriteLine($"Введите '{CloseAp}' для завершения работы"); | |
string word = "type"; | |
This file contains hidden or 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
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Random rand = new Random(); | |
int randomInt = rand.Next(1, 400); | |
Console.WriteLine($"Случайное число: {randomInt}"); | |
int currentPowOfTwo = 1; |
NewerOlder