Skip to content

Instantly share code, notes, and snippets.

View igorLisovitskiy's full-sized avatar

Igor Lisovitskiy igorLisovitskiy

View GitHub Profile
class Solution:
def topKFrequent(self, nums: List[int], k: int) -> List[int]:
output = []
counts = {}
for i in nums:
counts[i] = counts.get(i, 0) + 1
for top in range(k):
top_key = None
top_value = 0
for key, value in counts.items():
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def addTwoNumbers(self, l1, l2) -> Optional[ListNode]:
return self.get_sum_linked_list(l1, l2)
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def addTwoNumbers(self, l1: Optional[ListNode], l2: Optional[ListNode]) -> Optional[ListNode]:
return self.add_nodes(l1, l2)

Keybase proof

I hereby claim:

To claim this, I am signing this object:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp5
{
class Program
public static void Task4()
{
/*
4) Пользователь вводит с клавиатуры размерность одномерного массива n и заполняет его элементами. Найти и вывести на экран два наибольших элемента этого массива. (Значения элементов массива могут повторятся).
Примеры:
В массиве [1, 7, 6, 4, 9] два максимальных элемента — это числа 9 и 7.
В массиве [5, 1, 2, 9, 9] два максимальных элемента — это числа 9 и 9.
*/
Console.WriteLine("Enter the length of array");
int arrLength = Convert.ToInt32(Console.ReadLine());
int[] arr = { 1, 2, 3, 4, 5, 6, 3, 2, 1 };
int[] duplicates = new int[arr.Length];
for (int j = 0; j < arr.Length; j++)
{
int counter = 0;
for (int i = 0; i < arr.Length; i++)
{
if (arr[j] == arr[i])
{
using System;
namespace Andrew
{
class Program
{
public static void Count() //Задача 4
{
int a = 1;
using System;
namespace ReadConsole
{
class Program
{
public static void Print1DArrayOfNumbers(int[] arr)
{
foreach (int el in arr)
{
using System;
using System.Linq;
namespace RotateMatrix
{
class Program
{
public static int[] GetRow(int[,] matrix, int rowNumber)
{