Skip to content

Instantly share code, notes, and snippets.

View chubarich's full-sized avatar
🥸

chubarich

🥸
  • tutu.ru
  • Moscow
View GitHub Profile
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.LinkedHashSet;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
@chubarich
chubarich / Subsequence.java
Last active November 25, 2022 16:17
Task C
import java.io.*;
public class Subsequence {
private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
String small;
String big;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
@chubarich
chubarich / clean_code.md
Created November 21, 2018 12:39 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.RestrictTo;
import android.support.annotation.VisibleForTesting;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.os.ParcelableCompat;
public class RoutePreviewFragment extends BaseFragment {
private static final String ROUTE_KEY = "route_key";
@InjectPresenter
RoutesPresenter presenter;
@BindView(R.id.time) TextView routeTime;
@BindView(R.id.distance) TextView routeDistance;
@BindView(R.id.route_type) TextView routeType;
import java.io.File;
import java.io.FileNotFoundException;
import java.sql.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws ClassNotFoundException, SQLException, FileNotFoundException {
Class.forName("org.sqlite.JDBC");
static String gameOfThrones(String s){
// Complete this function
final String yes = "YES";
final String no = "NO";
char[] chars = s.toCharArray();
Map<Character, Character> items = new HashMap<>();
for (Character c : chars) {
if (!items.containsKey(c)) {
items.put(c, c);
} else {