The Table is a helper function to print the tabulation data bypassing the Any data! [e.g., 1d array, 2d array, and dictionary]. I’m sure if you practice coding interviews, it helps you a lot. You don’t need to struggle for checking results using a build-in print function!
Examples
The Table can print the tabulation data. It also supports the iPad playground.
The tableInfo function return the informations of data. I use the LosslessStringConvertible protocols to get the item width by checking the characters of string.
“For example, the integer value 1050 can be represented in its entirety as the string “1050”.”
This function didn’t considering the Unicode block so far. If you set the CJK(Chinese, Japanese, and Korean) characters then table layout will be broken. I’m going to solve it by using Unocode-Box-Drawing next time.
//Declaration of print function by Apple
func print<Target>(
_ items: Any...,
separator: String = " ",
terminator: String = "\n",
to output: inout Target
) where Target : TextOutputStream
The TextOutputStream is a protocol. The String type already conforms to TextOutputStream. So If you pass the reference of String at to in print function, The output of print will be written into String.
//https://github.com/apple/swift/blob/master/test/stdlib/Print.swift
PrintTests.test("StdoutUTF8") {
expectPrinted("µ", "\u{00B5}")
}
PrintTests.test("Varargs") {
var s0 = ""
print("", 1, 2, 3, 4, "", separator: "|", to: &s0)
expectEqual("|1|2|3|4|\n", s0)
var s1 = ""
print(1, 2, 3, separator: "\n", terminator: "===", to: &s1)
expectEqual("1\n2\n3===", s1)
var s2 = ""
print(4, 5, 6, separator: "\n", to: &s2)
expectEqual("4\n5\n6\n", s2)
var s3 = ""
print("", 1, 2, 3, 4, "", separator: "|", to: &s3)
expectEqual("|1|2|3|4|\n", s3)
}
I wrote the unit tests code by checking the result of function.
나이아가라 폭포 근처에 있는 KOA 캠핑장을 다녀왔습니다. 개인적으로 캠핑은 설치하고 정리해야 할 것들이 많아서 호텔이나 에어비앤비를 선호합니다만 KOA 캠핑장은 모든 것이 준비되어 있어요! 그리고 캠핑족을 위한 다양한 숙박형태도 갖추고 있죠. (텐트, 캠핑카, 독채 등등)
저는 오두막 같이 생긴 독채를 예약했습니다. 이곳은 호텔처럼 침대와 거실 그리고 화장실을 갖추고 있어서 아주 편리했습니다.
KOA 캠핑장 입구NIAGARA FALL KOA
KOA 캠핑장의 놀거리들
80년대 미국 영화에서 본 듯한 수영장 풍경엄청 넓은 덤블링 4인용 자전거놀이터미니 골프장이제 본격적으로 캠핑 느낌나는 장소로 이동~!캐나다 캠핑카 스케일 엄청나죠?
오두막 형태의 숙소
제가 머무른 숙소입니다.
별채공간이고 다른 별채와 공간이 적당히 떨어져 있습니다.
공간 구성을 간략하게 설명드릴게요
큰 방은 퀸 사이즈 침대 1개
작은 방은 2층 침대 2개
거실 및 부엌이 연결된 형태이고 쇼파와 TV가 있어요
화장실은 1개
주차공간 아주 넉넉
시골동네 같은 느낌공용 개수대가 깔끔
나이아가라 폭포와의 거리는?
저녁먹고 노을보러 찾아간 나이아가라 폭포
KOA 캠핑장은 체인점이라 미국과 캐나다 곳곳에 있는데 나이아가라 지점은 차로 약 10분 – 15분 거리 정도 됩니다. 미리 예약하고 가셔야 되고 예약은 KOA 캠핑 클릭하세요 😀
In Xcode 11, the scroll view has two new things, which are the Content Layout Guide and Frame Layout Guide.
It’s a very convenient way to set content size for scrollView.
Let’s check how to use it on the storyboard.
What is the Content Layout Guide?
It is the size of the content. For example, if your scrollView is enabled vertical scrolling only, then set the subviews constraints relative to the Content Layout Guide.
What is the Frame Layout Guide?
It is a fixed size of the content. For example, if scrollView is enabled vertical only, then just set the Frame Layout Guide’s width constraint and leave your height constraint.
How to resolve the constraint warnings?
The above steps is an essential for scrollView with its subView. However Storyboard may still complain.
To solve the constraint issue, change the intrinsic size of the scroll views subView.
Add stackView
For scrolling the contents, I added stackView with listViews.
The coding interview is hard because We have to remember the basic data structures and algorithms. For me, I received masters degree of computer science seven years ago. Most of the tech companies require the coding interview when you apply for a job. So I decided to summarize the data structure and algorithm.
Here is the list, and I’ll write the basic concept and will be solving problems using Swift
Complexity
Time Complexity
Space Complexity
Data Structures
Stack
Queue
Circular Queue
Linked List
Doubly Linked List
Reverse Linked List
Hash Table
Tree
Binary Tree
BFS
DFS
Pre-Order
In-Order
Post-Order
Binary Search Tree [Ordered Binary Tree]
Dictionary
Set
Graph
Directed
Undirected
Graph using an Adjacency Matrix
Graph using an Adjacency List and Set
Depth First
Breath First
Topological Sort
Weighted Graph
Negative Weighted Graph
Algorithms
Stack
Match parenthesis in an expression
find the minimum element in a expression
stack in constant time
Sorting
Selection Sort
Insertion Sort
Bubble Sort
Shell Sort
Merge Sort
Quick Sort
Search
Linear Search [Brute Force]
Binary Search [Sorted List]
Binary Tree
Find the minimum value in a Binary Search Tree
Find the maximum depth of a Binary Tree
Mirror a Binary Tree
Count the number of structurally unique binary tree possible
print all nodes within a range in a binary search tree
check if a binary tree is a binary search tree
check if a path from toot to leaf node sums up to a certain value
print all paths from the root to the leaf nodes
find the least common ancestor for 2 nodes
Heap [Priority Queue]
The Binary Heap
Minimum Heap
Maximum Heap
Balanced Binary Search Tree
An array or A list
Insert and remove from a Heap
Heapify
Heap Sort
Merge K sorted lists into one sorted array
maximum element in a minimum heap and K largest elements in a stream
Find the median In a stream of elements
Graph
Shortest path algorithm
Shortest path in a weighted graph
Dijkstra’s Algorithm [Greedy Algorithm]
Bellman Ford Algorithm [Shortest path in negative weighted graph] [Greedy Algorithm]
Dealing with negative cycles in the weighted graph [Bellman Ford Algorithm]
Prim’s Algorithm for a Minimal Spanning Tree [Undirected Graph] [Greedy Algorithm]
Kruskal’s Algorithm for a Minimal Spanning Tree for Forest [Priority Queue] [Connected / Unconnected]
Find the shortest path In a weight graph
Design A course schedule considering pre request for courses
You must be logged in to post a comment.