From 329faeca25807ff4c7f91eb157657f3151cb6f21 Mon Sep 17 00:00:00 2001 From: AldrinMarz7! <53973174+Dhoni77@users.noreply.github.com> Date: Wed, 9 Mar 2022 14:06:08 +0530 Subject: [PATCH] 0068 - Text Justification cpp file added --- .../0068.Text Justification/Solution.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 solution/0000-0099/0068.Text Justification/Solution.cpp diff --git a/solution/0000-0099/0068.Text Justification/Solution.cpp b/solution/0000-0099/0068.Text Justification/Solution.cpp new file mode 100644 index 0000000000000..be61f4e1fe641 --- /dev/null +++ b/solution/0000-0099/0068.Text Justification/Solution.cpp @@ -0,0 +1,43 @@ +class Solution { +public: +vector fullJustify(vector& words, int maxWidth) { + int n=words.size(); + vector result; + + for(int i=0;i 1 && i < n-1){ + int remaining = maxWidth - wordLen; + space = remaining / (numberofWords - 1) + 1; + extraSpace = remaining % (numberofWords-1); + } + + string line = words[begin]; + + for(int j=1;j