int main() { Solution s; std::vector<std::string> words; //["Here","is","an","example","of","text","justification."], 16 words.push_back(std::string("Here")); words.push_back(std::string("is")); words.push_back(std::string("an")); words.push_back(std::string("example")); words.push_back(std::string("of")); words.push_back(std::string("text")); words.push_back(std::string("justification")); std::vector<std::string> ans = s.fullJustify(words, 16); //["a","b","c","d","e"], 1 /* words.push_back(std::string("a")); words.push_back(std::string("b")); words.push_back(std::string("c")); words.push_back(std::string("d")); std::vector<std::string> ans = s.fullJustify(words, 1); */ //["Don't","go","around","saying","the","world","owes","you","a","living;","the","world","owes","you","nothing;","it","was","here","first."], 30 ["Don't go around saying the","world owes you a living; the ","world owes you nothing; it was","here first. "] ["Don't go around saying the","world owes you a living; the","world owes you nothing; it was","here first. "] cout << "result "; s.Output(ans); return 0; }
void test() { Solution s; vector<int> nums; srand((unsigned int)time(NULL)); for(int i = 0; i < 1; i++) { int val = rand() % 50; nums.push_back(val); } ListNode* head = s.BuildList(nums); ListNode* newHead = s.sortList(head); s.Output(newHead); }
void test() { Solution s; vector<int> nums1; vector<int> nums2; vector<int> nums3; vector<int> nums4; vector<int> nums5; nums1.push_back(1); nums1.push_back(3); nums1.push_back(10); nums2.push_back(2); nums2.push_back(3); nums2.push_back(5); nums2.push_back(6); nums3.push_back(1); nums3.push_back(2); nums3.push_back(7); nums4.push_back(3); nums4.push_back(4); nums4.push_back(5); nums5.push_back(7); nums5.push_back(8); nums5.push_back(9); vector<ListNode*> lists; ListNode* list1 = s.BuildList(nums1); ListNode* list2 = s.BuildList(nums2); ListNode* list3 = s.BuildList(nums3); ListNode* list4 = s.BuildList(nums4); ListNode* list5 = s.BuildList(nums5); lists.push_back(list1); lists.push_back(list2); lists.push_back(list3); lists.push_back(list4); lists.push_back(list5); ListNode* head = s.mergeKLists(lists); s.Output(head); }