マツシタのお勉強

AtCoder ABC057 D - Maximum Average Sets

問題 D: Maximum Average Sets - AtCoder Beginner Contest 057 | AtCoder N(1 <= N <= 50)個の品物が与えられ、それぞれの品物には価値Vi(1 <= i <= N)が設定されている。A個以上、B以下の品物を取ることが出来る時、選択した品物の価値の最大の平均値と、…

AtCoder ABC057 C - Digits in Multiplication

問題 C: Digits in Multiplication - AtCoder Beginner Contest 057 | AtCoder 整数N(1 <= N <= 1010)が与えられ、A * B = Nを満たすA, BについてF(A, B)の値が最小となるものを出力する問題。ここで、F(A, B)とはAとBの桁数を比べ小さい方の桁数を返り値す…

【グラフ理論とネットワーク理論】Matrix Expression of Graphs and Paths #2

Introduction Here is the article of the last time class. keita-matsushita.hatenablog.com Matrix Expression of Graphs and Paths Graphs can be expressed by matrixes. Below matrixes express above the graph. Incidence matrix (接続行列) Cols re…

【Deep Learning お勉強 #3】ニューラルネットワークとは

はじめに 前回の記事はこちら 【Deep Learning お勉強 #2】パーセプトロンを実装してみよう - マツシタケイタの技術ブログ(勉強中) 今回はニューラルネットワークについて触れる。 パーセプトロンからニューラルネットワークへ 復習も兼ねてパーセプトロンの…

【Deep Learning お勉強 #2】パーセプトロンを実装してみよう

はじめに この記事はパーセプトロンを実際に簡単な例を使って実装してみようというもの。 パーセプトロン自体の説明は以下の記事を参照。 keita-matsushita.hatenablog.com 論理回路をパーセプトロンで表現する 以下のテーブルはANDゲートの真偽値表である。…

【Deep Learningのお勉強 #1 】パーセプトロンとはなんぞや

はじめに 『ゼロから作るDeep Learning』という本を読み、得た知識などをメモとしてを書き記す。 また、この記事はパーセプトロンというアルゴリズムについてまとめる。 どうやら、パーセプトロンというものは、ディープラーニングの起源となるアルゴリズム…

【グラフ理論とネットワーク理論】Graph #1

グラフとは何か グラフは以下のコンポーネントで成り立つ。 節点、頂点: 対象物(スイッチ、ルータ) Node, Vertex: Objectives(Switch, Router) 枝、辺: 接点間の関係(伝送路) Branch, Edge: Relation among nodes(Transmission lines) つまり、グラフとは節…

SwiftでCurrentUserを実装する

ソースコード シングルトンを使って実装する。 参考 stackoverflow.com

AtCoder ARC 004 B - 2点間距離の最大と最小 ( Maximum and Minimum )

B - 2点間距離の最大と最小 ( Maximum and Minimum ) B: 2点間距離の最大と最小 ( Maximum and Minimum ) - AtCoder Regular Contest 004 | AtCoder N + 1個(0 ~ N)点がx,y平面上にある時、i番目の点とi+1番目の点との距離が与えられる(0 <= i < N)。 この時…

AtCoder ARC 004 A - 2点間距離の最大値 ( The longest distance )

A - 2点間距離の最大値 ( The longest distance ) A: 2点間距離の最大値 ( The longest distance ) - AtCoder Regular Contest 004 | AtCoder N個のx,y座標が与えられ、任意の2つの点の距離が最大となる値を出力する問題 解法 与えられる点の数がN(2 <= N <…

HimotokiとAPIKitでAPIクライアント

APIKitとは GitHub - ishkawa/APIKit: Type-safe networking abstraction layer that associates request type with response type. Himotokiとは GitHub - ikesyo/Himotoki: A type-safe JSON decoding library purely written in Swift 単一のモデルをデコ…

ネットワークの仮想化

ポートベースVLANとタグベースVLAN VLANとは、物理的にには1つのネットワークを理論的に複数のネットワークに分ける技術。 営業部が入居するオフィスに、経理部も同居することになった時、LAN配線は既存のもの使いながら、営業部と経理部とであたかも別の2…

TCP/IPで通信するための仕組み

可変長サブネットマスクとCIDR 可変長サブネットマスク サブネット毎に、サビネットマスクの長さを変えることができる技術。サブネットマスクの長さを自由に変えられるようになると、サブネット毎に接続するコンピュータ数を柔軟に決める事ができる。 CIDR …

TCP/IPの基礎知識

TCP/IP コンピュータネットワークで広く用いられている通信プロトコル。TCP(Transmission Control Protocol)とIP(Internet Protocol)と呼ばれるプロトコルのセット。 TCP/IPのレイヤー構成 アプリケーション層 ... 具体的な通信サービスを実現する トランス…

ネットワークの基礎知識

ネットワークとは ネットワークの働きは「アプリ同士が何かを行うためにデータをやり取りできるようにしてやること」。 それを実現するために、データを配送するためのルールや、使用する機器や通信媒体、サービス毎に決められたデータの形式や手順を覚えれ…

3Sum Closest : LeetCode

Problem leetcode.com 与えられたInt型の配列numsの要素の内、3つ選んだ要素の和がtargetに最も近い値を見つける問題。 Solution 全列挙によるO(N3)の解法 配列の全ての3つの要素の和を算出し、その中から一番targetに近い値を見つける事で問題を解くこと…

Maximum Size Subarray Sum Equals k

Problem discuss.leetcode.com Solution This problem can be solved by using HashMap effectively. First, we store each sum of range from 0 to i (0 <= i < N). While we traverse the array, we check if the (sum - k) is stored in HashMap. If the …

Alien Dictionary : LeetCode

Problem https://leetcode.com/problems/alien-dictionary/?tab=Description Solution This problem can be solved by using Topological Sort.

Combination Sum III : LeetCode

Problem leetcode.com Source Code

Implement Trie (Prefix Tree)

Problem leetcode.com Source Code

Problem leetcode.com Solution This problem can be solve by DFS with depth of tree. In my code, lists.size() == depth means that the traversing depth changes. Source Code

Maximum Product of Word Lengths

Problem leetcode.com Solution This problem can be solved effectively by using bit manipulation. We can manage the count of appearance of each letters. Lower case letters are transformed to Integer within 26. This takes 0(N2) time. Source C…

AWSにおける可用性を向上するパターンをまとめる

クラウドにおける可用性とは 「可用性(Availability)」とはシステムが継続して稼働できる能力の事。システムを稼働しているサーバーや、データを保存しておくデータベースが1つで設計されている場合、その1つが落ちた場合にシステムが止まってしまう。これ…

配列における3つの要素の和

Problem leetcode.com 与えられた配列において、任意の3点の和がゼロとなる組合せを全て取得する問題。 Solution この問題は以下のように解くことができる。 任意の3点をstart, middle, endと置く(start < middle < end) startを固定し、middle = start + …

AtCoder ABC D - Mixing Experiment

問題 D: Mixing Experiment - AtCoder Beginner Contest 054 | AtCoder 解き方 全列挙を考える 全列挙する場合、i番目の薬品を購入する場合としない場合を2パターンをN回行うので、計算量はO(2N)となりNは最大40なので間に合わない。 動的計画法を使う dp(i…

ビット操作を用いて順列を求める

どの部分の要素を既に使用したかをbitを用いて管理する

Sort Objects with Comparator

Heaps: Find the Running Median

Problem www.hackerrank.com This problem is that we calculate median of array the range is from 0 to ith. Solution By using Two Priority Queues: minHeap and maxHeap, we can solve this problem. The roles of them are following. minHeap : To s…

Trie Tree in Java

What is Trie Tree Trie Tree is one of the tree structure to search element. The feature of this tree that each node dose not have element information, but also each edge has element information. Trie tree is used to search String like dict…

Heap Sort in Java

What is Heap Reference www.youtube.com Heap is the tree structure that has two following restrictions. Binary Tree Parent node is smaller or bigger than children nodes. Heap is good at controlling the relation about small and large. So hea…